Skip to content

Commit

Permalink
Merge pull request #2 from platform9/private/graham/venv-fix
Browse files Browse the repository at this point in the history
Bugfix Merges
  • Loading branch information
jb4free authored Nov 8, 2017
2 parents c3361af + b955cd7 commit f611404
Show file tree
Hide file tree
Showing 6 changed files with 33 additions and 18 deletions.
1 change: 0 additions & 1 deletion ansible.cfg
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
[defaults]
host_key_checking = False
inventory = inventory/
remote_user = root
role_path = roles
display_skipped_hosts = False
nocows=1
Expand Down
2 changes: 1 addition & 1 deletion inventory/openstack_hosts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
[localhost]
localhost ansible_become=no ansible_connection=local
localhost ansible_become=no ansible_connection=local ansible_python_interpreter="/usr/bin/env python"
2 changes: 1 addition & 1 deletion roles/neutron-prerequisites/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ neutron_kernel_modules:
- 8021q
- bonding
- bridge
- br_netfilter
- tun
27 changes: 19 additions & 8 deletions roles/pf9-auth/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,21 @@
- os_region
- os_tenant

- name: Create local files/ directory
connection: local
become: no
file:
state: directory
path: files/

- name: Check if cached Keystone token exists
stat:
path: /root/keystone-token.txt
path: files/keystone-token.txt
register: cached_token

- block:
- name: Load OS_AUTH_TOKEN into fact
set_fact: "os_auth_token={{ lookup('file', '/root/keystone-token.txt') | trim }}"
set_fact: "os_auth_token={{ lookup('file', 'files/keystone-token.txt') | trim }}"

- name: Validate Keystone token
uri:
Expand All @@ -30,22 +37,26 @@
when: cached_token.stat.exists == True

- block:
- name: Obtain authentication token from Keystone
os_auth:
auth:
- name: Set OS_AUTH fact
set_fact:
os_auth:
auth_url: "{{ du_url }}/keystone/v2.0"
username: "{{ os_username }}"
password: "{{ os_password }}"
project_name: "{{ os_tenant }}"
region_name: "{{ os_region }}"
validate_certs: False

- name: Obtain authentication token from Keystone
become: no
local_action: "os_auth auth={{ os_auth }} region_name={{ os_tenant }}"
check_mode: no
register: auth_reply

- name: Save OS Auth Token
connection: local
become: no
copy:
content: "{{ auth_reply.ansible_facts.auth_token }}"
dest: /root/keystone-token.txt
dest: files/keystone-token.txt

- name: Store OS_AUTH_TOKEN in fact
set_fact: "os_auth_token={{ auth_reply.ansible_facts.auth_token }}"
Expand Down
1 change: 1 addition & 0 deletions roles/pf9-hostagent/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
---
- name: Download Platform9 installers
connection: local
become: no
get_url:
url: "{{ du_url }}/private/platform9-install-{{ item }}.sh"
dest: "/tmp/platform9-install-{{ item }}.sh"
Expand Down
18 changes: 11 additions & 7 deletions roles/pf9-hostagent/tasks/packages.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
---
- name: Check pf9-hostagent on Debian
command: dpkg-query -s pf9-hostagent
when: ansible_pkg_mgr == "apt"
ignore_errors: True
register: pkg_state
changed_when: pkg_state.rc != 0
register: pkg_state_debian
changed_when: pkg_state_debian.rc != 0
when:
- ansible_os_family == "Debian"
- ansible_pkg_mgr == "apt"

- name: Check pf9-hostagent on Red Hat
command: rpm -q pf9-hostagent
when: ansible_pkg_mgr == "yum"
ignore_errors: True
register: pkg_state
changed_when: pkg_state.rc != 0
register: pkg_state_redhat
changed_when: pkg_state_redhat.rc != 0
when:
- ansible_os_family == "RedHat"
- ansible_pkg_mgr == "yum"

- name: Install pf9-hostagent on hypervisor
script: "/tmp/platform9-install-{{ ansible_os_family|lower }}.sh --no-proxy --no-ntpd"
when: pkg_state|failed
when: pkg_state_debian|failed or pkg_state_redhat|failed

0 comments on commit f611404

Please sign in to comment.