From 87612abc0e24cafd89a49e350165b08fe1608233 Mon Sep 17 00:00:00 2001 From: baigk Date: Thu, 6 Aug 2015 02:37:33 -0400 Subject: support deployment openstack juno with ansible for compass in centos7.1 JIRA: COMPASS-6 Change-Id: I8ef865e8acfe29c3ff5c7e9030e4cebabed3457b Signed-off-by: baigk --- .../adapters/ansible/roles/common/tasks/main.yml | 16 ++++++----- .../adapters/ansible/roles/common/templates/hosts | 31 +++++++--------------- .../ansible/roles/common/templates/pip.conf | 2 ++ .../adapters/ansible/roles/common/vars/Debian.yml | 5 ++-- .../adapters/ansible/roles/common/vars/RedHat.yml | 5 ++++ deploy/adapters/ansible/roles/common/vars/main.yml | 6 +++++ 6 files changed, 33 insertions(+), 32 deletions(-) create mode 100644 deploy/adapters/ansible/roles/common/vars/RedHat.yml create mode 100644 deploy/adapters/ansible/roles/common/vars/main.yml (limited to 'deploy/adapters/ansible/roles/common') diff --git a/deploy/adapters/ansible/roles/common/tasks/main.yml b/deploy/adapters/ansible/roles/common/tasks/main.yml index 452f7683..1b20c0fd 100644 --- a/deploy/adapters/ansible/roles/common/tasks/main.yml +++ b/deploy/adapters/ansible/roles/common/tasks/main.yml @@ -2,11 +2,11 @@ - include_vars: "{{ ansible_os_family }}.yml" - name: first update pkgs - apt: update_cache=yes + shell: "{{ ansible_pkg_mgr }} update" - name: install packages action: "{{ ansible_pkg_mgr }} name={{ item }} state=latest" - with_items: packages + with_items: packages | union(packages_noarch) - name: update hosts files to all hosts template: src=hosts @@ -21,8 +21,10 @@ shell: awk -F'=' '/compass_server/ {print $2}' /etc/compass.conf register: ip -- name: update compass-core name and ip to hosts files - shell: echo "# compass\n"{{ ip.stdout_lines[0] }} {{ name.stdout_lines[0] }} >> /etc/hosts +- name: update compass-core name and ip to hosts files + shell: | + echo "# compass" >> /etc/hosts + echo {{ ip.stdout_lines[0] }} {{ name.stdout_lines[0] }} >> /etc/hosts - name: create pip config directory file: path=~/.pip state=directory @@ -34,12 +36,12 @@ - name: update pip.conf template: src=pip.conf dest=~/.pip/pip.conf -- name: restart ntp - command: su -s /bin/sh -c "service ntp stop; ntpd -gq; hwclock --systohc" +- name: sync between sys clock and hard clock + command: su -s /bin/sh -c "service {{ ntp_service }} stop; ntpd -gq; hwclock --systohc" ignore_errors: True - name: update ntp conf template: src=ntp.conf dest=/etc/ntp.conf backup=yes - name: restart ntp - service: name=ntp state=restarted enabled=yes + service: name={{ ntp_service }} state=restarted enabled=yes diff --git a/deploy/adapters/ansible/roles/common/templates/hosts b/deploy/adapters/ansible/roles/common/templates/hosts index 9d27c0a9..bb770d5b 100644 --- a/deploy/adapters/ansible/roles/common/templates/hosts +++ b/deploy/adapters/ansible/roles/common/templates/hosts @@ -1,22 +1,9 @@ -# compute-controller -10.145.89.136 host-136 -# database -10.145.89.136 host-136 -# messaging -10.145.89.136 host-136 -# storage-controller -10.145.89.138 host-138 -# image -10.145.89.138 host-138 -# identity -10.145.89.136 host-136 -# network-server -10.145.89.138 host-138 -# dashboard -10.145.89.136 host-136 -# storage-volume -10.145.89.139 host-139 -# network-worker -10.145.89.139 host-139 -# compute-worker -10.145.89.137 host-137 +# localhost +127.0.0.1 localhost +# controller +10.1.0.50 host1 +10.1.0.51 host2 +10.1.0.52 host3 +# compute +10.1.0.53 host4 +10.1.0.54 host5 diff --git a/deploy/adapters/ansible/roles/common/templates/pip.conf b/deploy/adapters/ansible/roles/common/templates/pip.conf index 4e1309a1..7bb3e43e 100644 --- a/deploy/adapters/ansible/roles/common/templates/pip.conf +++ b/deploy/adapters/ansible/roles/common/templates/pip.conf @@ -1,3 +1,5 @@ [global] find-links = http://{{ COMPASS_SERVER.stdout_lines[0] }}/pip no-index = true +[install] +trusted-host={{ COMPASS_SERVER.stdout_lines[0] }} diff --git a/deploy/adapters/ansible/roles/common/vars/Debian.yml b/deploy/adapters/ansible/roles/common/vars/Debian.yml index c763efdc..af6130cb 100644 --- a/deploy/adapters/ansible/roles/common/vars/Debian.yml +++ b/deploy/adapters/ansible/roles/common/vars/Debian.yml @@ -1,7 +1,6 @@ --- packages: - ubuntu-cloud-keyring - - python-pip - python-dev - - python-mysqldb - - ntp + +ntp_service: ntp diff --git a/deploy/adapters/ansible/roles/common/vars/RedHat.yml b/deploy/adapters/ansible/roles/common/vars/RedHat.yml new file mode 100644 index 00000000..f75c253e --- /dev/null +++ b/deploy/adapters/ansible/roles/common/vars/RedHat.yml @@ -0,0 +1,5 @@ +--- +packages: + - python-devel + +ntp_service: ntpd diff --git a/deploy/adapters/ansible/roles/common/vars/main.yml b/deploy/adapters/ansible/roles/common/vars/main.yml new file mode 100644 index 00000000..2c5b5679 --- /dev/null +++ b/deploy/adapters/ansible/roles/common/vars/main.yml @@ -0,0 +1,6 @@ +--- +packages_noarch: + - python-pip + - ntp + +services_noarch: [] -- cgit 1.2.3-korg