Skip to content

Commit

Permalink
Stop using playbooks and start using roles in ansibleee
Browse files Browse the repository at this point in the history
  • Loading branch information
jlarriba committed Jul 3, 2023
1 parent 3695de8 commit b9a8b90
Show file tree
Hide file tree
Showing 16 changed files with 46 additions and 23 deletions.
2 changes: 1 addition & 1 deletion api/bases/telemetry.openstack.org_ceilometercomputes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spec:
type: string
type: object
playbook:
default: osp.edpm.deploy_edpm_telemetry_ceilometer.yml
default: deploy_ceilometer.yml
description: Playbook executed
type: string
rabbitMqClusterName:
Expand Down
2 changes: 1 addition & 1 deletion api/bases/telemetry.openstack.org_infracomputes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
container
type: string
playbook:
default: osp.edpm.deploy_edpm_telemetry_infra.yml
default: deploy_infra.yml
description: Playbook executed
type: string
serviceAccount:
Expand Down
4 changes: 2 additions & 2 deletions api/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ spec:
type: string
type: object
playbook:
default: osp.edpm.deploy_edpm_telemetry_ceilometer.yml
default: deploy_ceilometer.yml
description: Playbook executed
type: string
rabbitMqClusterName:
Expand Down Expand Up @@ -220,7 +220,7 @@ spec:
container
type: string
playbook:
default: osp.edpm.deploy_edpm_telemetry_infra.yml
default: deploy_infra.yml
description: Playbook executed
type: string
serviceAccount:
Expand Down
4 changes: 0 additions & 4 deletions api/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN
github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI=
github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE=
github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk=
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
Expand All @@ -231,7 +230,6 @@ github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc=
github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ=
github.com/openstack-k8s-operators/lib-common/modules/common v0.0.0-20230627132558-cd98c8b86310 h1:LEtGGR0u6LGkcQVqms++XEfvUS8Vt5aJio+QKq0aaso=
github.com/openstack-k8s-operators/lib-common/modules/common v0.0.0-20230627132558-cd98c8b86310/go.mod h1:cAXLyeKp6TiLW8qongnw6WR63Jnsm8CeRC5y07z3TAY=
github.com/pkg/diff v0.0.0-20210226163009-20ebb0f2a09e/go.mod h1:pJLUxLENpZxwdsKMEsNbx1VGcRFpLqf3715MtcvvzbA=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down Expand Up @@ -266,9 +264,7 @@ github.com/prometheus/procfs v0.8.0 h1:ODq8ZFEaYeCaZOJlZZdJA2AbQR98dSHSM1KW/You5
github.com/prometheus/procfs v0.8.0/go.mod h1:z7EfXMXOkbkqb9IINtpCn86r/to3BnA0uaxHdg830/4=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs=
github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ=
github.com/rogpeppe/go-internal v1.10.0/go.mod h1:UQnix2H7Ngw/k4C5ijL5+65zddjncjaFoBhdsK/akog=
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE=
github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88=
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/ceilometercompute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ type CeilometerComputeSpec struct {
DataplaneInventoryConfigMap string `json:"dataplaneInventoryConfigMap"`

// Playbook executed
// +kubebuilder:default:="osp.edpm.deploy_edpm_telemetry_ceilometer.yml"
// +kubebuilder:default:="deploy_ceilometer.yml"
Playbook string `json:"playbook,omitempty"`

// ServiceAccount - service account name used internally to provide the default SA name
Expand Down
2 changes: 1 addition & 1 deletion api/v1beta1/infracompute_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ type InfraComputeSpec struct {
DataplaneInventoryConfigMap string `json:"dataplaneInventoryConfigMap"`

// Playbook executed
// +kubebuilder:default:="osp.edpm.deploy_edpm_telemetry_infra.yml"
// +kubebuilder:default:="deploy_infra.yml"
Playbook string `json:"playbook,omitempty"`

// The extravars ConfigMap to pass to ansible execution
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ spec:
type: string
type: object
playbook:
default: osp.edpm.deploy_edpm_telemetry_ceilometer.yml
default: deploy_ceilometer.yml
description: Playbook executed
type: string
rabbitMqClusterName:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ spec:
container
type: string
playbook:
default: osp.edpm.deploy_edpm_telemetry_infra.yml
default: deploy_infra.yml
description: Playbook executed
type: string
serviceAccount:
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/telemetry.openstack.org_telemetries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ spec:
type: string
type: object
playbook:
default: osp.edpm.deploy_edpm_telemetry_ceilometer.yml
default: deploy_ceilometer.yml
description: Playbook executed
type: string
rabbitMqClusterName:
Expand Down Expand Up @@ -220,7 +220,7 @@ spec:
container
type: string
playbook:
default: osp.edpm.deploy_edpm_telemetry_infra.yml
default: deploy_infra.yml
description: Playbook executed
type: string
serviceAccount:
Expand Down
1 change: 0 additions & 1 deletion config/samples/telemetry_v1beta1_ceilometercompute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,3 @@ spec:
dataplaneInventoryConfigMap: dataplanerole-edpm-compute
initImage: quay.io/podified-antelope-centos9/openstack-ceilometer-compute:current-podified
computeImage: quay.io/podified-antelope-centos9/openstack-ceilometer-compute:current-podified
playbook: osp.edpm.deploy_edpm_telemetry_ceilometer.yml
1 change: 0 additions & 1 deletion config/samples/telemetry_v1beta1_infracompute.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,3 @@ spec:
dataplaneSSHSecret: dataplane-ansible-ssh-private-key-secret
dataplaneInventoryConfigMap: dataplanerole-edpm-compute
nodeExporterImage: quay.io/prometheus/node-exporter:v1.5.0
playbook: osp.edpm.deploy_edpm_telemetry_infra.yml
2 changes: 0 additions & 2 deletions config/samples/telemetry_v1beta1_telemetry.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,11 @@ spec:
ceilometerCompute:
initImage: quay.io/podified-antelope-centos9/openstack-ceilometer-compute:current-podified
computeImage: quay.io/podified-antelope-centos9/openstack-ceilometer-compute:current-podified
playbook: deploy-ceilometer.yaml
dataplaneSSHSecret: dataplane-ansible-ssh-private-key-secret
dataplaneInventoryConfigMap: dataplanerole-edpm-compute
serviceAccount: telemetry-operator-telemetry
infraCompute:
nodeExporterImage: quay.io/prometheus/node-exporter:v1.5.0
playbook: deploy-infra.yaml
serviceAccount: telemetry-operator-telemetry
dataplaneSSHSecret: dataplane-ansible-ssh-private-key-secret
dataplaneInventoryConfigMap: dataplanerole-edpm-compute
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ require (
github.com/openstack-k8s-operators/keystone-operator/api v0.0.0-20230622141005-e9220a4b3dfe
github.com/openstack-k8s-operators/lib-common/modules/common v0.0.0-20230627132558-cd98c8b86310
github.com/openstack-k8s-operators/lib-common/modules/storage v0.0.0-20230627132558-cd98c8b86310
github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.0.0-20230620085730-fddf65f65f88
github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.0.0-20230703102858-87737b736377
github.com/openstack-k8s-operators/telemetry-operator/api v0.0.0-00010101000000-000000000000
k8s.io/api v0.26.3
k8s.io/apimachinery v0.26.3
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -191,8 +191,8 @@ github.com/openstack-k8s-operators/lib-common/modules/openstack v0.0.0-202305221
github.com/openstack-k8s-operators/lib-common/modules/openstack v0.0.0-20230522113906-6f4206cbf317/go.mod h1:doFbVg0WhS++gy17cbP9/BrCySjCpuqKx7TbvmKPChY=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.0.0-20230627132558-cd98c8b86310 h1:ks7tXrCN87bQaVrNMroqM+pgr2joCnf7ow5aYdGAcnY=
github.com/openstack-k8s-operators/lib-common/modules/storage v0.0.0-20230627132558-cd98c8b86310/go.mod h1:7sbo6DydOwpl8Ex1atTbXIrWYvZ++eSOJ0Z6RphJJ44=
github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.0.0-20230620085730-fddf65f65f88 h1:l1s8NZfIRKeiMrTsDQAKw44EwWQ2waaWv+TpJz+93Bk=
github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.0.0-20230620085730-fddf65f65f88/go.mod h1:e4hw70sdvXG8anfBSGq5VMq11h52aN/TI3HYxjPyDGE=
github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.0.0-20230703102858-87737b736377 h1:3p9z0lGbZthsrvY7lwtdrlUm1LTUnFKwBJWFadjsEQE=
github.com/openstack-k8s-operators/openstack-ansibleee-operator/api v0.0.0-20230703102858-87737b736377/go.mod h1:dpIdzGakxXSbkIC5f3iuqMVMtr7N2VLtKT2sqPK4fso=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
Expand Down
17 changes: 16 additions & 1 deletion pkg/ceilometercompute/ansibleee.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,22 @@ func AnsibleEE(

ansibleeeSpec := ansibleeev1.NewOpenStackAnsibleEE(ServiceName)

ansibleeeSpec.Playbook = instance.Spec.Playbook
role := &ansibleeev1.Role{
Strategy: "free",
Become: true,
Tasks: []ansibleeev1.Task{
{
Name: "Deploy ceilometer",
ImportRole: ansibleeev1.ImportRole{
Name: "osp.edpm.edpm_telemetry",
TasksFrom: instance.Spec.Playbook,
},
Tags: []string{"edpm_telemetry"},
},
},
}

ansibleeeSpec.Role = role

ansibleeeSpec.Env = []corev1.EnvVar{
{Name: "ANSIBLE_FORCE_COLOR", Value: "True"},
Expand Down
18 changes: 17 additions & 1 deletion pkg/infracompute/ansibleee.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,23 @@ func AnsibleEE(

ansibleeeSpec := ansibleeev1.NewOpenStackAnsibleEE(ServiceName)

ansibleeeSpec.Playbook = instance.Spec.Playbook
role := &ansibleeev1.Role{
Strategy: "free",
Become: true,
Tasks: []ansibleeev1.Task{
{
Name: "Deploy ceilometer",
ImportRole: ansibleeev1.ImportRole{
Name: "osp.edpm.edpm_telemetry",
TasksFrom: instance.Spec.Playbook,
},
Tags: []string{"edpm_telemetry"},
},
},
}

ansibleeeSpec.Role = role

ansibleeeSpec.Env = []corev1.EnvVar{
{Name: "ANSIBLE_FORCE_COLOR", Value: "True"},
{Name: "ANSIBLE_SSH_ARGS", Value: "-C -o ControlMaster=auto -o ControlPersist=80s"},
Expand Down

0 comments on commit b9a8b90

Please sign in to comment.