Allow creating Stack for non centos images

This patch updates nodepool-setup and multinodes
roles to work with non centos images. It updates following:-

- Add a role variable: "default_image_user" which defaults to
  'centos'. It can be used to configure image_user like 'fedora'.
- Use 'package' module instead of 'yum' so it can work with non
  yum systems.
- yum_contentdir is not needed for Fedora, so skipped.
- centos-release-openstack and epel repos are not needed for
  Fedora, so skipped.

Change-Id: Ia1245a423e608273120b2c6b9668e2126073cccc
This commit is contained in:
yatinkarel 2019-07-28 23:05:51 +05:30
parent 9406975449
commit cf6b8259ba
3 changed files with 7 additions and 5 deletions

View File

@ -31,3 +31,4 @@ subnode_flavor: m1.large
subnode_groups:
- subnodes
nodepool_user: zuul
default_image_user: centos

View File

@ -128,7 +128,7 @@
name: "subnode-{{ item.0 }}"
hostname: "{{ item.1.1 }}"
groups: "{{ subnode_groups| join(',') }}"
ansible_user: centos
ansible_user: "{{ default_image_user }}"
ansible_host: "{{ item.1.1 }}"
ansible_fqdn: "subnode-{{ item.0 }}"
ansible_private_key_file: "{{ private_key_location }}"
@ -139,7 +139,7 @@
- name: Wait for provisioned hosts to become reachable
command:
ssh -o BatchMode=yes -o "StrictHostKeyChecking=no" centos@{{ hostvars[item].ansible_host }} -i "{{ private_key_location }}"
ssh -o BatchMode=yes -o "StrictHostKeyChecking=no" {{ default_image_user }}@{{ hostvars[item].ansible_host }} -i "{{ private_key_location }}"
register: result
until: result is success
retries: 100

View File

@ -30,7 +30,7 @@
path: /etc/yum/vars/contentdir
register: yum_contentdir
- when: not yum_contentdir.stat.exists
- when: not yum_contentdir.stat.exists and ansible_distribution|lower != 'fedora'
block:
- name: Discover package architecture
@ -63,9 +63,10 @@
- centos-release-openstack-ocata
- epel-release
become: true
when: ansible_distribution|lower != 'fedora'
- name: Install packages
yum:
package:
name: "{{ packages_list }}"
state: latest
become: true
@ -140,7 +141,7 @@
block:
- name: Update packages
yum:
package:
name: '*'
state: latest
become: true