Connect to localhost as remote host for cinder/nova

Trying to dynamically switch connection types and become
just doesn't work, so instead we force all role tests to
setup a different inventory_hostname for the services on
localhost so that Ansible connects to it in a different
way and we don't have to try and fudge it.

Change-Id: Ibbbab05efb0170bd66bf829a5d6c2ce136cb120f
This commit is contained in:
Jesse Pretorius 2018-07-19 18:28:31 +01:00
parent 41172895cd
commit 7c3e6d4b67
2 changed files with 1 additions and 24 deletions

View File

@ -50,14 +50,6 @@
- name: Deploy the rest of cinder
hosts: "cinder_all:!cinder_api"
remote_user: root
# Some services run on localhost. For that to work,
# we need to sudo. Ideally it should rather be broken
# out into its own playbook and use 'connection: local'
# but to do that we'd have to know which service it is
# and every role's inventory is different. So instead,
# we use this rather horrible hack.
become: "{{ inventory_hostname == 'localhost' }}"
connection: "{{ (inventory_hostname == 'localhost') | ternary('local', 'ssh') }}"
gather_facts: true
any_errors_fatal: true
roles:

View File

@ -18,14 +18,6 @@
- name: Prepare for nova services
hosts: nova_all
remote_user: root
# Some services run on localhost. For that to work,
# we need to sudo. Ideally it should rather be broken
# out into its own playbook and use 'connection: local'
# but to do that we'd have to know which service it is
# and every role's inventory is different. So instead,
# we use this rather horrible hack.
become: "{{ inventory_hostname == 'localhost' }}"
connection: "{{ (inventory_hostname == 'localhost') | ternary('local', 'ssh') }}"
gather_facts: true
any_errors_fatal: true
vars:
@ -96,14 +88,7 @@
- name: Deploy nova compute
hosts: "nova_compute"
# Some services run on localhost. For that to work,
# we need to sudo. Ideally it should rather be broken
# out into its own playbook and use 'connection: local'
# but to do that we'd have to know which service it is
# and every role's inventory is different. So instead,
# we use this rather horrible hack.
become: "{{ inventory_hostname == 'localhost' }}"
connection: "{{ (inventory_hostname == 'localhost') | ternary('local', 'ssh') }}"
remote_user: root
gather_facts: true
any_errors_fatal: true
roles: