diff --git a/config/instances.yaml b/config/instances.yaml index 83c501e..4e31e42 100644 --- a/config/instances.yaml +++ b/config/instances.yaml @@ -1,10 +1,41 @@ provider_config: bms: + ssh_pwd: password + ssh_user: root + ntpserver: 0.debian.pool.ntp.org + domainsuffix: local instances: - bms1: + mgmt: provider: bms - ip: 192.168.1.100 + ip: 10.0.34.239 + roles: + config_database: + config: + control: + analytics_database: + analytics: + webui: + kvm1: + provider: bms + ip: 10.0.35.177 + roles: + vrouter: + kvm2: + provider: bms + ip: 10.0.35.195 + roles: + vrouter: + kvm3: + provider: bms + ip: 10.0.35.196 + roles: + vrouter: global_configuration: - CONTAINER_REGISTRY: michaelhenkel + CONTAINER_REGISTRY: tungstenfabric contrail_configuration: - CONTRAIL_VERSION: queens-5.0-20180219195722 + CONTRAIL_VERSION: latest + CONFIG_NODEMGR__DEFAULTS__minimum_diskGB: 2 + DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + CONFIG_DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + UPGRADE_KERNEL: true +ansible_os_family: "RedHat" diff --git a/config/instances.yaml.centos7.opencontrail b/config/instances.yaml.centos7.opencontrail new file mode 100644 index 0000000..6a53cc6 --- /dev/null +++ b/config/instances.yaml.centos7.opencontrail @@ -0,0 +1,41 @@ +provider_config: + bms: + ssh_pwd: password + ssh_user: root + ntpserver: 0.debian.pool.ntp.org + domainsuffix: local +instances: + controller: + provider: bms + ip: 10.0.34.228 + roles: + config_database: + config: + control: + analytics_database: + analytics: + webui: + gateway: + provider: bms + ip: 172.20.0.180 + roles: + vrouter: + kvm1: + provider: bms + ip: 172.20.0.181 + roles: + vrouter: + kvm2: + provider: bms + ip: 172.20.0.182 + roles: + vrouter: +global_configuration: +contrail_configuration: + CONTRAIL_VERSION: latest + CONFIG_NODEMGR__DEFAULTS__minimum_diskGB: 2 + DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + CONFIG_DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + UPGRADE_KERNEL: true + VROUTER_GATEWAY: 172.20.0.1 +ansible_os_family: "RedHat" diff --git a/config/instances.yaml.orig b/config/instances.yaml.orig new file mode 100644 index 0000000..83c501e --- /dev/null +++ b/config/instances.yaml.orig @@ -0,0 +1,10 @@ +provider_config: + bms: +instances: + bms1: + provider: bms + ip: 192.168.1.100 +global_configuration: + CONTAINER_REGISTRY: michaelhenkel +contrail_configuration: + CONTRAIL_VERSION: queens-5.0-20180219195722 diff --git a/config/instances.yaml.rocky8.private b/config/instances.yaml.rocky8.private new file mode 100644 index 0000000..bc35fd1 --- /dev/null +++ b/config/instances.yaml.rocky8.private @@ -0,0 +1,47 @@ +provider_config: + bms: + ssh_pwd: password + ssh_user: root + ntpserver: 0.debian.pool.ntp.org + domainsuffix: local +instances: + controller: + provider: bms + ip: 10.0.34.228 + roles: + config_database: + config: + control: + analytics_database: + analytics: + webui: + gateway: + provider: bms + ip: 172.20.0.180 + roles: + vrouter: + kvm1: + provider: bms + ip: 172.20.0.181 + roles: + vrouter: + kvm2: + provider: bms + ip: 172.20.0.182 + roles: + vrouter: +global_configuration: + CONTAINER_REGISTRY: 10.0.34.8:5000/tungstenfabric + REGISTRY_PRIVATE_INSECURE: true + CONTAINER_REGISTRY_USERNAME: username + CONTAINER_REGISTRY_PASSWORD: password +contrail_configuration: + CONTRAIL_VERSION: "2023-03-10" + CONFIG_NODEMGR__DEFAULTS__minimum_diskGB: 2 + DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + CONFIG_DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + UPGRADE_KERNEL: false + VROUTER_GATEWAY: 172.20.0.1 + #CONTROL_NODES: +ansible_os_family: "RedHat" +ansible_python_interpreter: /usr/bin/python3 diff --git a/config/instances.yaml.rocky8.tungstenfabric b/config/instances.yaml.rocky8.tungstenfabric new file mode 100644 index 0000000..4339d23 --- /dev/null +++ b/config/instances.yaml.rocky8.tungstenfabric @@ -0,0 +1,44 @@ +provider_config: + bms: + ssh_pwd: password + ssh_user: root + ntpserver: 0.debian.pool.ntp.org + domainsuffix: local +instances: + controller: + provider: bms + ip: 10.0.34.228 + roles: + config_database: + config: + control: + analytics_database: + analytics: + webui: + gateway: + provider: bms + ip: 172.20.0.180 + roles: + vrouter: + kvm1: + provider: bms + ip: 172.20.0.181 + roles: + vrouter: + kvm2: + provider: bms + ip: 172.20.0.182 + roles: + vrouter: +global_configuration: + CONTAINER_REGISTRY: tungstenfabric +contrail_configuration: + CONTRAIL_VERSION: "2023-03-10" + CONFIG_NODEMGR__DEFAULTS__minimum_diskGB: 2 + DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + CONFIG_DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + UPGRADE_KERNEL: false + VROUTER_GATEWAY: 172.20.0.1 + #CONTROL_NODES: +ansible_os_family: "RedHat" +ansible_python_interpreter: /usr/bin/python3 diff --git a/config/instances.yaml.ubuntu22.private b/config/instances.yaml.ubuntu22.private new file mode 100644 index 0000000..110126e --- /dev/null +++ b/config/instances.yaml.ubuntu22.private @@ -0,0 +1,47 @@ +provider_config: + bms: + ssh_pwd: password + ssh_user: root + ntpserver: 0.debian.pool.ntp.org + domainsuffix: local +instances: + controller: + provider: bms + ip: 10.0.34.228 + roles: + config_database: + config: + control: + analytics_database: + analytics: + webui: + gateway: + provider: bms + ip: 172.20.0.180 + roles: + vrouter: + kvm1: + provider: bms + ip: 172.20.0.181 + roles: + vrouter: + kvm2: + provider: bms + ip: 172.20.0.182 + roles: + vrouter: +global_configuration: + CONTAINER_REGISTRY: 10.0.34.8:5000/tungstenfabric + REGISTRY_PRIVATE_INSECURE: true + CONTAINER_REGISTRY_USERNAME: username + CONTAINER_REGISTRY_PASSWORD: password +contrail_configuration: + CONTRAIL_VERSION: "2023-03-10" + CONFIG_NODEMGR__DEFAULTS__minimum_diskGB: 2 + DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + CONFIG_DATABASE_NODEMGR__DEFAULTS__minimum_diskGB: 2 + UPGRADE_KERNEL: false + VROUTER_GATEWAY: 172.20.0.1 + #CONTROL_NODES: +ansible_os_family: "Debian" +ansible_python_interpreter: /usr/bin/python3 diff --git a/deploy_tungsten_centos.sh b/deploy_tungsten_centos.sh new file mode 100755 index 0000000..e6673a9 --- /dev/null +++ b/deploy_tungsten_centos.sh @@ -0,0 +1,69 @@ +#!/bin/bash + +# 1. Get OS version + +if [ -f /etc/redhat-release ] ; then + DIST=`cat /etc/redhat-release | awk '{print $1}'` + CODENAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` + REV=`cat /etc/redhat-release | awk '{print $3,$4}' | grep -o "[0-9.]*"` +elif [ -f /etc/lsb-release ] ; then + DIST=`cat /etc/lsb-release | grep DISTRIB_ID | tr "\n" ' '| sed s/.*=//` + REV=`cat /etc/lsb-release | grep DISTRIB_RELEASE | tr "\n" ' '| sed s/.*=//` + CODENAME=`cat /etc/lsb-release | grep DISTRIB_CODENAME | tr "\n" ' '| sed s/.*=//` +elif [ -f /etc/os-release ] ; then + DIST=`grep -e "^NAME=" /etc/os-release | awk -F\" '{print $2}'` + REV=`grep -e "^VERSION_ID=" /etc/os-release | awk -F\" '{print $2}'` + CODENAME=`grep -e "^PRETTY_NAME=" /etc/os-release | awk -F\" '{print $2}'` +fi + +if [[ ! $REV =~ ^8.* ]] && [[ ! $REV =~ ^7.* ]];then + echo "This script can ONLY be executed on CentOS/Rocky 7/8" + exit 1 +fi + +# 2. Install packages + +if [[ $REV =~ ^7.* ]];then + yum install -y epel-release sshpass + rpm -qa |grep python2-pip || yum install -y python2-pip + + pip install pip==20.3.4 + pip install requests + pip install --ignore-installed PyYAML + pip install ansible==2.7.18 +elif [[ $REV =~ ^8.* ]];then + pip3 -V || yum install -y python3-pip + pip3 install --upgrade pip + pip3 install requests + pip3 install --upgrade PyYAML + ls /usr/bin/python || ln -s /usr/bin/python3 /usr/bin/python + + ansible-playbook -v || yum install -y epel-release && yum install -y ansible + pip3 install --upgrade ansible +fi + +# 3. Configure instances + +ansible-playbook -i inventory/ -e orchestrator=none playbooks/configure_instances.yml && \ + +# 4. Install contrail + +ansible-playbook -i inventory/ -e orchestrator=none playbooks/install_contrail.yml && \ + +# 5. DONE + +ui_ip=$(python -c " +import yaml +configs=yaml.safe_load(open('config/instances.yaml')) +ui_ip=None +for server in configs['instances']: + if 'webui' in configs['instances'][server]['roles'].keys(): + ui_ip=configs['instances'][server]['ip'] + break +print(ui_ip) +") && \ + +echo "Tungsten has been installed successfully." && \ +echo "Please access the web UI using admin/contrail123" && \ +echo "- https://${ui_ip}:8143" && \ +echo "- http://${ui_ip}:8180" diff --git a/playbooks/roles/contrail_analytics/tasks/main.yml b/playbooks/roles/contrail_analytics/tasks/main.yml index ded9895..071e9b7 100644 --- a/playbooks/roles/contrail_analytics/tasks/main.yml +++ b/playbooks/roles/contrail_analytics/tasks/main.yml @@ -46,7 +46,7 @@ dest: /etc/contrail/analytics/docker-compose.yaml - name: start contrail analytics - docker_service: + docker_compose: project_src: /etc/contrail/analytics environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_analytics/tasks/stop.yml b/playbooks/roles/contrail_analytics/tasks/stop.yml index b17ab0c..cc4748d 100644 --- a/playbooks/roles/contrail_analytics/tasks/stop.yml +++ b/playbooks/roles/contrail_analytics/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: stop contrail analytics - docker_service: + docker_compose: project_src: /etc/contrail/analytics state: absent environment: diff --git a/playbooks/roles/contrail_analytics_alarm/tasks/main.yml b/playbooks/roles/contrail_analytics_alarm/tasks/main.yml index 0e53ee6..0e52325 100644 --- a/playbooks/roles/contrail_analytics_alarm/tasks/main.yml +++ b/playbooks/roles/contrail_analytics_alarm/tasks/main.yml @@ -21,7 +21,7 @@ dest: /etc/contrail/analytics_alarm/docker-compose.yaml - name: start contrail analytics_alarm - docker_service: + docker_compose: project_src: /etc/contrail/analytics_alarm environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_analytics_alarm/tasks/stop.yml b/playbooks/roles/contrail_analytics_alarm/tasks/stop.yml index d58d400..721f0e6 100644 --- a/playbooks/roles/contrail_analytics_alarm/tasks/stop.yml +++ b/playbooks/roles/contrail_analytics_alarm/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: stop contrail analytics_alarm - docker_service: + docker_compose: project_src: /etc/contrail/analytics_alarm state: absent environment: diff --git a/playbooks/roles/contrail_analytics_database/tasks/main.yml b/playbooks/roles/contrail_analytics_database/tasks/main.yml index 50b1394..04b89ed 100644 --- a/playbooks/roles/contrail_analytics_database/tasks/main.yml +++ b/playbooks/roles/contrail_analytics_database/tasks/main.yml @@ -57,7 +57,7 @@ dest: /etc/contrail/analytics_database/docker-compose.yaml - name: start contrail analyticsdb - docker_service: + docker_compose: project_src: /etc/contrail/analytics_database environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_analytics_database/tasks/stop.yml b/playbooks/roles/contrail_analytics_database/tasks/stop.yml index 8e15e79..dfd25a6 100644 --- a/playbooks/roles/contrail_analytics_database/tasks/stop.yml +++ b/playbooks/roles/contrail_analytics_database/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: stop contrail analyticsdb - docker_service: + docker_compose: project_src: /etc/contrail/analytics_database state: absent environment: diff --git a/playbooks/roles/contrail_analytics_snmp/tasks/main.yml b/playbooks/roles/contrail_analytics_snmp/tasks/main.yml index 085d877..624ef80 100644 --- a/playbooks/roles/contrail_analytics_snmp/tasks/main.yml +++ b/playbooks/roles/contrail_analytics_snmp/tasks/main.yml @@ -11,7 +11,7 @@ dest: /etc/contrail/analytics_snmp/docker-compose.yaml - name: start contrail analytics_snmp - docker_service: + docker_compose: project_src: /etc/contrail/analytics_snmp environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_analytics_snmp/tasks/stop.yml b/playbooks/roles/contrail_analytics_snmp/tasks/stop.yml index c0775be..dcfd9f5 100644 --- a/playbooks/roles/contrail_analytics_snmp/tasks/stop.yml +++ b/playbooks/roles/contrail_analytics_snmp/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: stop contrail analytics_snmp - docker_service: + docker_compose: project_src: /etc/contrail/analytics_snmp state: absent environment: diff --git a/playbooks/roles/contrail_compute_legacy/tasks/main.yml b/playbooks/roles/contrail_compute_legacy/tasks/main.yml index b1fef5f..9fae611 100644 --- a/playbooks/roles/contrail_compute_legacy/tasks/main.yml +++ b/playbooks/roles/contrail_compute_legacy/tasks/main.yml @@ -19,7 +19,7 @@ dest: "/etc/contrail/compute-legacy/docker-compose.yaml" - name: "start contrail compute-legacy" - docker_service: + docker_compose: project_src: /etc/contrail/compute-legacy environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_config/tasks/main.yml b/playbooks/roles/contrail_config/tasks/main.yml index fe1fdc2..1ac4835 100644 --- a/playbooks/roles/contrail_config/tasks/main.yml +++ b/playbooks/roles/contrail_config/tasks/main.yml @@ -63,7 +63,7 @@ dest: /etc/contrail/config/docker-compose.yaml - name: start contrail config - docker_service: + docker_compose: project_src: /etc/contrail/config environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_config/tasks/stop.yml b/playbooks/roles/contrail_config/tasks/stop.yml index 2a4a054..8f9ff11 100644 --- a/playbooks/roles/contrail_config/tasks/stop.yml +++ b/playbooks/roles/contrail_config/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: stop contrail config service - docker_service: + docker_compose: project_src: /etc/contrail/config state: absent environment: diff --git a/playbooks/roles/contrail_config_database/tasks/main.yml b/playbooks/roles/contrail_config_database/tasks/main.yml index 2ce55f8..2c01483 100644 --- a/playbooks/roles/contrail_config_database/tasks/main.yml +++ b/playbooks/roles/contrail_config_database/tasks/main.yml @@ -87,7 +87,7 @@ dest: /etc/contrail/config_database/docker-compose.yaml - name: start contrail config database - docker_service: + docker_compose: project_src: /etc/contrail/config_database environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_config_database/tasks/stop.yml b/playbooks/roles/contrail_config_database/tasks/stop.yml index ad53668..4132584 100644 --- a/playbooks/roles/contrail_config_database/tasks/stop.yml +++ b/playbooks/roles/contrail_config_database/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: stop contrail config database - docker_service: + docker_compose: project_src: /etc/contrail/config_database state: absent environment: diff --git a/playbooks/roles/contrail_control/tasks/main.yml b/playbooks/roles/contrail_control/tasks/main.yml index 68e29a8..1e1f387 100644 --- a/playbooks/roles/contrail_control/tasks/main.yml +++ b/playbooks/roles/contrail_control/tasks/main.yml @@ -89,7 +89,7 @@ dest: "/etc/contrail/control/docker-compose.yaml" - name: "start contrail control" - docker_service: + docker_compose: project_src: /etc/contrail/control environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_control/tasks/stop.yml b/playbooks/roles/contrail_control/tasks/stop.yml index 77c457d..c657d63 100644 --- a/playbooks/roles/contrail_control/tasks/stop.yml +++ b/playbooks/roles/contrail_control/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: "Stop contrail control" - docker_service: + docker_compose: project_src: /etc/contrail/control state: absent environment: diff --git a/playbooks/roles/contrail_control_only/tasks/step2.yml b/playbooks/roles/contrail_control_only/tasks/step2.yml index 0de5a43..54955d9 100644 --- a/playbooks/roles/contrail_control_only/tasks/step2.yml +++ b/playbooks/roles/contrail_control_only/tasks/step2.yml @@ -76,7 +76,7 @@ dest: "/etc/contrail/control_only_{{ location.key }}/docker-compose.yaml" - name: "start contrail control {{ location.key }}" - docker_service: + docker_compose: project_src: "/etc/contrail/control_only_{{ location.key }}" environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_control_only/tasks/stop.yml b/playbooks/roles/contrail_control_only/tasks/stop.yml index 30d3349..4fda55e 100644 --- a/playbooks/roles/contrail_control_only/tasks/stop.yml +++ b/playbooks/roles/contrail_control_only/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: Stop control only - docker_service: + docker_compose: project_src: "/etc/contrail/control_only_{{ location.key }}" state: absent environment: diff --git a/playbooks/roles/contrail_deployer/tasks/generate_ca.yml b/playbooks/roles/contrail_deployer/tasks/generate_ca.yml index 0b48504..51c5e37 100644 --- a/playbooks/roles/contrail_deployer/tasks/generate_ca.yml +++ b/playbooks/roles/contrail_deployer/tasks/generate_ca.yml @@ -5,7 +5,7 @@ state: present register: res retries: 5 - until: res | success + until: res is success - name: create certs directories become: yes diff --git a/playbooks/roles/contrail_k8s_cni/tasks/main.yml b/playbooks/roles/contrail_k8s_cni/tasks/main.yml index 6dd0cf9..e48d395 100644 --- a/playbooks/roles/contrail_k8s_cni/tasks/main.yml +++ b/playbooks/roles/contrail_k8s_cni/tasks/main.yml @@ -70,7 +70,7 @@ dest: "/etc/contrail/cni/docker-compose.yaml" - name: "start contrail cni" - docker_service: + docker_compose: project_src: /etc/contrail/cni environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_k8s_kubemanager/tasks/main.yml b/playbooks/roles/contrail_k8s_kubemanager/tasks/main.yml index d372380..1bad647 100644 --- a/playbooks/roles/contrail_k8s_kubemanager/tasks/main.yml +++ b/playbooks/roles/contrail_k8s_kubemanager/tasks/main.yml @@ -51,7 +51,7 @@ dest: /etc/contrail/kubemanager_{{ kube_cluster_name }}/docker-compose.yaml - name: start contrail kubemanager - docker_service: + docker_compose: project_src: /etc/contrail/kubemanager_{{ kube_cluster_name }} environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_mesos_cni/tasks/main.yml b/playbooks/roles/contrail_mesos_cni/tasks/main.yml index c0a4343..25cd66f 100644 --- a/playbooks/roles/contrail_mesos_cni/tasks/main.yml +++ b/playbooks/roles/contrail_mesos_cni/tasks/main.yml @@ -70,7 +70,7 @@ dest: "/etc/contrail/cni/docker-compose.yaml" - name: "start contrail cni" - docker_service: + docker_compose: project_src: /etc/contrail/cni environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_mesos_mesosmanager/tasks/main.yml b/playbooks/roles/contrail_mesos_mesosmanager/tasks/main.yml index 2dea329..e631460 100644 --- a/playbooks/roles/contrail_mesos_mesosmanager/tasks/main.yml +++ b/playbooks/roles/contrail_mesos_mesosmanager/tasks/main.yml @@ -47,7 +47,7 @@ dest: /etc/contrail/mesosmanager/docker-compose.yaml - name: start contrail mesosmanager - docker_service: + docker_compose: project_src: /etc/contrail/mesosmanager environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_redis/tasks/main.yml b/playbooks/roles/contrail_redis/tasks/main.yml index 1615ca3..dd3db02 100644 --- a/playbooks/roles/contrail_redis/tasks/main.yml +++ b/playbooks/roles/contrail_redis/tasks/main.yml @@ -15,7 +15,7 @@ dest: "/etc/contrail/redis/docker-compose.yaml" - name: "start redis" - docker_service: + docker_compose: project_src: /etc/contrail/redis environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_redis/tasks/stop.yml b/playbooks/roles/contrail_redis/tasks/stop.yml index f270ada..8a17e71 100644 --- a/playbooks/roles/contrail_redis/tasks/stop.yml +++ b/playbooks/roles/contrail_redis/tasks/stop.yml @@ -1,6 +1,6 @@ --- - name: "stop redis" - docker_service: + docker_compose: project_src: /etc/contrail/redis state: absent environment: diff --git a/playbooks/roles/contrail_rsyslogd/tasks/main.yml b/playbooks/roles/contrail_rsyslogd/tasks/main.yml index a99d7c3..6d0406b 100644 --- a/playbooks/roles/contrail_rsyslogd/tasks/main.yml +++ b/playbooks/roles/contrail_rsyslogd/tasks/main.yml @@ -11,7 +11,7 @@ dest: "/etc/contrail/rsyslogd/docker-compose.yaml" - name: "start rsyslogd" - docker_service: + docker_compose: project_src: /etc/contrail/rsyslogd environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_toragent/tasks/delete.yml b/playbooks/roles/contrail_toragent/tasks/delete.yml index c908603..0d4be77 100644 --- a/playbooks/roles/contrail_toragent/tasks/delete.yml +++ b/playbooks/roles/contrail_toragent/tasks/delete.yml @@ -25,7 +25,7 @@ - cleanup - name: Stop and remove toragent Container and volumes - docker_service: + docker_compose: project_src: /etc/contrail/{{ toragent_name }} state: absent remove_images: all diff --git a/playbooks/roles/contrail_toragent/tasks/toragent.yml b/playbooks/roles/contrail_toragent/tasks/toragent.yml index d0b43b3..7f5deb7 100644 --- a/playbooks/roles/contrail_toragent/tasks/toragent.yml +++ b/playbooks/roles/contrail_toragent/tasks/toragent.yml @@ -45,7 +45,7 @@ dest: "/etc/contrail/{{ toragent_name }}/docker-compose.yaml" - name: "start contrail {{ toragent_name }}" - docker_service: + docker_compose: project_src: /etc/contrail/{{ toragent_name }} environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_vcenter_fabric_manager/tasks/main.yml b/playbooks/roles/contrail_vcenter_fabric_manager/tasks/main.yml index 4c0dd21..d209c69 100644 --- a/playbooks/roles/contrail_vcenter_fabric_manager/tasks/main.yml +++ b/playbooks/roles/contrail_vcenter_fabric_manager/tasks/main.yml @@ -39,7 +39,7 @@ dest: /etc/contrail/vcenter_fabric_manager/docker-compose.yaml - name: start contrail vcenter-fabric-manager - docker_service: + docker_compose: project_src: /etc/contrail/vcenter_fabric_manager environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_vcenter_manager/tasks/main.yml b/playbooks/roles/contrail_vcenter_manager/tasks/main.yml index 3e07b43..2f3d064 100644 --- a/playbooks/roles/contrail_vcenter_manager/tasks/main.yml +++ b/playbooks/roles/contrail_vcenter_manager/tasks/main.yml @@ -45,6 +45,6 @@ dest: /etc/contrail/vcenter_manager/docker-compose.yaml - name: start contrail vcenter-manager - docker_service: + docker_compose: project_src: /etc/contrail/vcenter_manager diff --git a/playbooks/roles/contrail_vcenter_plugin/tasks/main.yml b/playbooks/roles/contrail_vcenter_plugin/tasks/main.yml index 71bd8b3..21b9166 100644 --- a/playbooks/roles/contrail_vcenter_plugin/tasks/main.yml +++ b/playbooks/roles/contrail_vcenter_plugin/tasks/main.yml @@ -85,7 +85,7 @@ when: roles[item.key].vrouter is defined and instances[item.key].esxi_host is defined - name: start contrail vcenter-plugin - docker_service: + docker_compose: project_src: /etc/contrail/vcenter_plugin environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_vrouter/tasks/delete.yml b/playbooks/roles/contrail_vrouter/tasks/delete.yml index 27ede61..65a4bdb 100644 --- a/playbooks/roles/contrail_vrouter/tasks/delete.yml +++ b/playbooks/roles/contrail_vrouter/tasks/delete.yml @@ -14,7 +14,7 @@ - cleanup - name: Stop and remove Vrouter Container and volumes - docker_service: + docker_compose: project_src: /etc/contrail/vrouter state: absent remove_images: all diff --git a/playbooks/roles/contrail_vrouter/tasks/main.yml b/playbooks/roles/contrail_vrouter/tasks/main.yml index 57a1cde..b461881 100644 --- a/playbooks/roles/contrail_vrouter/tasks/main.yml +++ b/playbooks/roles/contrail_vrouter/tasks/main.yml @@ -68,7 +68,7 @@ - name: set vrouter kernel init image name set_fact: vrouter_kernel_init_img_name: contrail-vrouter-kernel-init - when: ansible_os_family == 'RedHat' + when: ansible_os_family in ['RedHat', 'Rocky', 'AlmaLinux'] - name: stop agent and remove old vrouter if kernel-init version changed when: roles[instance_name].vrouter.AGENT_MODE is undefined or roles[instance_name].vrouter.AGENT_MODE != 'dpdk' @@ -113,7 +113,7 @@ recurse: yes - name: "start contrail vrouter" - docker_service: + docker_compose: project_src: /etc/contrail/vrouter environment: DOCKER_CLIENT_TIMEOUT: '120' @@ -135,7 +135,7 @@ when: roles[instance_name].vrouter.AGENT_MODE is defined and roles[instance_name].vrouter.AGENT_MODE == 'dpdk' - name: "start contrail dpdk vrouter" - docker_service: + docker_compose: project_src: /etc/contrail/vrouter environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_vrouter/tasks/update_images.yml b/playbooks/roles/contrail_vrouter/tasks/update_images.yml index 29b0d5c..1c64099 100644 --- a/playbooks/roles/contrail_vrouter/tasks/update_images.yml +++ b/playbooks/roles/contrail_vrouter/tasks/update_images.yml @@ -8,7 +8,7 @@ set_fact: vrouter_kernel_init_img_name: contrail-vrouter-kernel-init when: - - ansible_os_family == 'RedHat' + - ansible_os_family in ['RedHat', 'Rocky', 'AlmaLinux'] - name: update image shell: "docker pull {{ container_registry }}/{{ item }}:{{ contrail_version_tag }}" diff --git a/playbooks/roles/contrail_webui/tasks/main.yml b/playbooks/roles/contrail_webui/tasks/main.yml index 9854d1b..dfd4ddf 100644 --- a/playbooks/roles/contrail_webui/tasks/main.yml +++ b/playbooks/roles/contrail_webui/tasks/main.yml @@ -47,7 +47,7 @@ dest: "/etc/contrail/webui/docker-compose.yaml" - name: "start contrail webui" - docker_service: + docker_compose: project_src: /etc/contrail/webui environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/contrail_webui/tasks/stop.yml b/playbooks/roles/contrail_webui/tasks/stop.yml index 9fb2e2f..73c9723 100644 --- a/playbooks/roles/contrail_webui/tasks/stop.yml +++ b/playbooks/roles/contrail_webui/tasks/stop.yml @@ -1,5 +1,5 @@ - name: "stop contrail webui" - docker_service: + docker_compose: project_src: /etc/contrail/webui state: absent environment: diff --git a/playbooks/roles/destroy/tasks/main.yml b/playbooks/roles/destroy/tasks/main.yml index d59500b..917ac76 100644 --- a/playbooks/roles/destroy/tasks/main.yml +++ b/playbooks/roles/destroy/tasks/main.yml @@ -11,7 +11,7 @@ register: rc with_items: "{{ dir_out.files }}" -- docker_service: +- docker_compose: project_src: "{{ item.item.path }}" state: absent remove_images: all diff --git a/playbooks/roles/docker/tasks/Debian.yml b/playbooks/roles/docker/tasks/Debian.yml index cc90260..a92a84a 100644 --- a/playbooks/roles/docker/tasks/Debian.yml +++ b/playbooks/roles/docker/tasks/Debian.yml @@ -1,31 +1,29 @@ --- -- name: Install pre-requisites + +- name: Remove package unattended-upgrades apt: - name: "{{ item }}" - register: res - retries: 5 - until: res | success + pkg: "{{ item }}" + state: absent + force: true with_items: - - apt-transport-https - - ca-certificates - - curl - - software-properties-common + - unattended-upgrades + when: ansible_facts['os_family'] == "Debian" + ignore_errors: yes -- name: add docker repo key - apt_key: - url: https://download.docker.com/linux/ubuntu/gpg - state: present +- name: Make sure /var/lib/dpkg/lock-frontend is not in use + shell: "lsof -t /var/lib/dpkg/lock-frontend | xargs kill -9" + when: ansible_facts['os_family'] == "Debian" + ignore_errors: yes -- name: create docker repo - apt_repository: - repo: "deb [arch=amd64] https://download.docker.com/linux/ubuntu {{ ansible_distribution_release }} stable" - state: present - -- name: install docker +- name: Install docker-compose apt: - name: "docker-ce=18.06.3~ce~3-0~ubuntu" - state: present - update_cache: yes + name: "{{ item }}" register: res retries: 5 - until: res | success + until: res is success + with_items: + - docker-compose + +- name: upgrade docker-compose and PyYAML on Ubuntu 22.04 + shell: pip3 install PyYAML docker-compose --upgrade + when: ansible_os_family == "Debian" and ansible_distribution_major_version|int == 22 diff --git a/playbooks/roles/docker/tasks/RedHat.yml b/playbooks/roles/docker/tasks/RedHat.yml index 9e90cd2..4ddff5b 100644 --- a/playbooks/roles/docker/tasks/RedHat.yml +++ b/playbooks/roles/docker/tasks/RedHat.yml @@ -1,12 +1,12 @@ --- -- name: create docker repo - yum_repository: - name: dockerrepo - description: Docker Repository - baseurl: https://download.docker.com/linux/centos/7/$basearch/stable - gpgkey: https://download.docker.com/linux/centos/gpg - gpgcheck: yes - when: docker_mirror_url is not defined +- name: Install yum-utils + yum: + name: yum-utils + state: present + +- name: Add Docker repo + command: + cmd: yum-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo - name: configure docker mirror yum_repository: @@ -16,19 +16,9 @@ gpgcheck: no when: docker_mirror_url is defined -# docker-ce-18 requries pigz which is available starting from rhel8 -# so, use epel -- name: configure epel - yum: - name: https://dl.fedoraproject.org/pub/epel/epel-release-latest-{{ ansible_distribution_major_version }}.noarch.rpm - when: ansible_distribution_major_version|int < 8 - register: res - retries: 5 - until: res | success - - name: install docker yum: - name: docker-ce-18.03.1.ce + name: docker-ce register: res retries: 5 - until: res | success + until: res is success diff --git a/playbooks/roles/docker/tasks/insecure_registry_Linux.yml b/playbooks/roles/docker/tasks/insecure_registry_Linux.yml index 27dd7b6..8e76872 100644 --- a/playbooks/roles/docker/tasks/insecure_registry_Linux.yml +++ b/playbooks/roles/docker/tasks/insecure_registry_Linux.yml @@ -39,12 +39,9 @@ - name: reload systemd shell: systemctl daemon-reload - when: ansible_os_family == 'RedHat' + when: ansible_os_family in ['RedHat', 'Rocky', 'AlmaLinux'] - - name: restart docker daemon - service: - enabled: yes - name: docker - state: restarted + - name: start and reload docker daemon + shell: systemctl start docker && systemctl reload docker when: docker_registry.split('/')[0] not in insecure_registries diff --git a/playbooks/roles/haproxy/tasks/main.yml b/playbooks/roles/haproxy/tasks/main.yml index b64eb7a..8c94b89 100644 --- a/playbooks/roles/haproxy/tasks/main.yml +++ b/playbooks/roles/haproxy/tasks/main.yml @@ -71,7 +71,7 @@ dest: "/etc/contrail/tsn_haproxy/docker-compose.yaml" - name: "start tsn_haproxy container" - docker_service: + docker_compose: project_src: /etc/contrail/tsn_haproxy environment: DOCKER_CLIENT_TIMEOUT: '120' diff --git a/playbooks/roles/instance/tasks/Debian_kernel.yml b/playbooks/roles/instance/tasks/Debian_kernel.yml index 1527d4a..0c2bf0a 100644 --- a/playbooks/roles/instance/tasks/Debian_kernel.yml +++ b/playbooks/roles/instance/tasks/Debian_kernel.yml @@ -7,7 +7,7 @@ install_recommends: yes register: upgrade_kernel retries: 5 - until: upgrade_kernel | success + until: upgrade_kernel is success when: (contrail_configuration.UPGRADE_KERNEL is defined and contrail_configuration.UPGRADE_KERNEL == true) or (instance_data.UPGRADE_KERNEL is defined and instance_data.UPGRADE_KERNEL == true) diff --git a/playbooks/roles/instance/tasks/RedHat.yml b/playbooks/roles/instance/tasks/RedHat.yml index 735ce07..4d2a8d7 100644 --- a/playbooks/roles/instance/tasks/RedHat.yml +++ b/playbooks/roles/instance/tasks/RedHat.yml @@ -1,4 +1,10 @@ --- +- name: install libselinux-python package required by selinux + yum: + name: "libselinux-python" + state: present + when: ansible_distribution_major_version|int == 7 + - name: set selinux to permissive selinux: policy: targeted diff --git a/playbooks/roles/instance/tasks/install_software_Linux.yml b/playbooks/roles/instance/tasks/install_software_Linux.yml index 7c3fa41..b108c85 100644 --- a/playbooks/roles/instance/tasks/install_software_Linux.yml +++ b/playbooks/roles/instance/tasks/install_software_Linux.yml @@ -48,7 +48,8 @@ version: "1.24.1" register: res retries: 5 - until: res | success + until: res is success + when: ansible_os_family == "RedHat" - name: Manage /etc/hosts include: manage_etc_hosts.yml diff --git a/playbooks/roles/instance/tasks/ntp.yml b/playbooks/roles/instance/tasks/ntp.yml index 8eb11d6..ea4263d 100644 --- a/playbooks/roles/instance/tasks/ntp.yml +++ b/playbooks/roles/instance/tasks/ntp.yml @@ -7,7 +7,8 @@ state: latest register: res retries: 5 - until: res | success + until: res is success + when: ansible_distribution_major_version|int == 7 - name: set ntp service name set_fact: @@ -15,18 +16,30 @@ - name: stop ntp service service: name={{ ntp_svc_name }} state=stopped enabled=yes + when: ansible_distribution_major_version|int == 7 - name: set ntp server template: src: ntp.conf.j2 dest: /etc/ntp.conf + when: ansible_distribution_major_version|int == 7 - name: initial time sync shell: "ntpdate {{ provider_data.ntpserver }}" ignore_errors: yes + when: ansible_distribution_major_version|int == 7 - name: start ntp service service: name={{ ntp_svc_name }} state=started enabled=yes + when: ansible_distribution_major_version|int == 7 + +- name: Install chrony + dnf: + name: ['chrony', 'ntpstat'] + state: present + update_cache: yes + when: + - ansible_distribution_major_version|int == 8 # centos(redhat?) uses chronyd by default and run it after restart instead of ntpd # service can be absent - so ignore it diff --git a/playbooks/roles/k8s/tasks/configure_k8s_master_node.yml b/playbooks/roles/k8s/tasks/configure_k8s_master_node.yml index d51b336..2ba70e5 100644 --- a/playbooks/roles/k8s/tasks/configure_k8s_master_node.yml +++ b/playbooks/roles/k8s/tasks/configure_k8s_master_node.yml @@ -43,7 +43,7 @@ when: listen_ip is defined and master_running == false register: res retries: 5 - until: res | success + until: res is success - name: initialize k8s master without listen ip shell: | diff --git a/playbooks/roles/k8s/tasks/main.yml b/playbooks/roles/k8s/tasks/main.yml index 8ca39ee..3f8d251 100644 --- a/playbooks/roles/k8s/tasks/main.yml +++ b/playbooks/roles/k8s/tasks/main.yml @@ -60,7 +60,7 @@ when: k8s_package_version is defined register: res retries: 5 - until: res | success + until: res is success - name: configure k8s master include: configure_k8s_master_node.yml diff --git a/playbooks/roles/kolla_deployer/tasks/create_kolla_playbooks.yml b/playbooks/roles/kolla_deployer/tasks/create_kolla_playbooks.yml index 46379ab..b465b09 100644 --- a/playbooks/roles/kolla_deployer/tasks/create_kolla_playbooks.yml +++ b/playbooks/roles/kolla_deployer/tasks/create_kolla_playbooks.yml @@ -38,7 +38,7 @@ requirements: "{{ kolla_dir }}/requirements.txt" register: res retries: 5 - until: res | success + until: res is success - name: install kolla libraries shell: "{{ ansible_python.executable }} setup.py install --force" diff --git a/playbooks/roles/openstack/tasks/kolla_baremetal.yml b/playbooks/roles/openstack/tasks/kolla_baremetal.yml index 03872f5..6cf434e 100644 --- a/playbooks/roles/openstack/tasks/kolla_baremetal.yml +++ b/playbooks/roles/openstack/tasks/kolla_baremetal.yml @@ -39,7 +39,7 @@ - kolla_globals.enable_swift | default('yes') | bool register: res retries: 5 - until: res | success + until: res is success - name: Install configfs module needed for ironic on Debian hosts modprobe: diff --git a/playbooks/roles/pip/tasks/main.yml b/playbooks/roles/pip/tasks/main.yml index 3aba766..451730d 100644 --- a/playbooks/roles/pip/tasks/main.yml +++ b/playbooks/roles/pip/tasks/main.yml @@ -12,8 +12,10 @@ - PyYAML register: res retries: 5 - until: res | success - when: ansible_os_family == 'RedHat' + until: res is success + vars: + ansible_python_interpreter: /usr/bin/python2 + when: ansible_os_family == 'RedHat' and ansible_distribution_major_version|int == 7 # NOTE: Do not use easy_install for RedHat. There is a bug that might cause # easy_install to hang: @@ -25,6 +27,7 @@ shell: pip2 --version ignore_errors: true register: pip_check + when: ansible_distribution_major_version|int == 7 - name: Install pip block: @@ -38,6 +41,7 @@ shell: "python /tmp/get-pip.py 'pip==20.1'" become: yes when: + - ansible_distribution_major_version|int == 7 - pip_check.rc != 0 # if pip was already there then it should be updated if it's version is less than 10.0 @@ -48,4 +52,36 @@ become: yes register: res retries: 5 - until: res | success + when: ansible_distribution_major_version|int == 7 + until: res is success + +- name: check if pip3 present + shell: pip3 --version + ignore_errors: true + register: pip_check + when: (ansible_distribution_major_version|int == 8) or (ansible_os_family == 'Debian') + +- name: Install python3-pip on rocky8 + yum: name={{ item }} state=installed update_cache=yes + with_items: + - python3-pip + when: + - ansible_distribution_major_version|int == 8 + - pip_check.rc != 0 + +- name: upgrade pip on rocky8 + shell: pip3 install pip --upgrade + when: ansible_distribution_major_version|int == 8 + +- name: Install python3-pip on Ubuntu + apt: + name: "{{ item }}" + update_cache: yes + register: res + retries: 5 + until: res is success + with_items: + - python3-pip + when: + - ansible_os_family == 'Debian' + - pip_check.rc != 0 diff --git a/playbooks/roles/windows_deployer/tasks/main.yml b/playbooks/roles/windows_deployer/tasks/main.yml index ec26d49..3061411 100644 --- a/playbooks/roles/windows_deployer/tasks/main.yml +++ b/playbooks/roles/windows_deployer/tasks/main.yml @@ -6,7 +6,7 @@ state: latest register: res retries: 5 - until: res | success + until: res is success with_items: - pywinrm - requests