diff options
author | Tomas Sedovic <tomas@sedovic.cz> | 2017-07-14 12:22:51 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-14 12:22:51 +0200 |
commit | fb3d95ff05257906d846562b752fb9258794dc38 (patch) | |
tree | a1a4d482d6c0f209b6d973f9b6e7fa37e97878b5 | |
parent | ac46aa1d392cd8d42cc15bbc7c9b77944f09997b (diff) | |
download | openshift-fb3d95ff05257906d846562b752fb9258794dc38.tar.gz openshift-fb3d95ff05257906d846562b752fb9258794dc38.tar.bz2 openshift-fb3d95ff05257906d846562b752fb9258794dc38.tar.xz openshift-fb3d95ff05257906d846562b752fb9258794dc38.zip |
Set up NetworkManager automatically (#542)
* Set up NetworkManager automatically
This removes the extra step of running the
`openshift-ansible/playbooks/byo/openshift-node/network_manager.yml`
before installing openshift. In addition, the playbook relies on a
host group that the provisioning doesn't provide (oo_all_hosts).
Instead, we set up NetworkManager on CentOS nodes automatically. And
we restart it on RHEL (which is necessary for the nodes to pick up the
new DNS we configured the subnet with).
This makes the provisioning easier and more resilient.
* Apply the node-network-manager role to every node
It makes the code simpler and more consistent across distros.
-rw-r--r-- | playbooks/provisioning/openstack/README.md | 3 | ||||
-rw-r--r-- | playbooks/provisioning/openstack/post-provision-openstack.yml | 6 | ||||
-rw-r--r-- | roles/node-network-manager/tasks/main.yml | 22 |
3 files changed, 26 insertions, 5 deletions
diff --git a/playbooks/provisioning/openstack/README.md b/playbooks/provisioning/openstack/README.md index 05e7e791a..5c2f61202 100644 --- a/playbooks/provisioning/openstack/README.md +++ b/playbooks/provisioning/openstack/README.md @@ -181,11 +181,8 @@ file, this is how you stat the provisioning process: Once it succeeds, you can install openshift by running: - ansible-playbook --become --user openshift --private-key ~/.ssh/openshift -i inventory/ openshift-ansible/playbooks/byo/openshift-node/network_manager.yml ansible-playbook --become --user openshift --private-key ~/.ssh/openshift -i inventory/ openshift-ansible/playbooks/byo/config.yml -Note, the `network_manager.yml` step is mandatory and is required for persisting -the hosts' DNS configs. ## License diff --git a/playbooks/provisioning/openstack/post-provision-openstack.yml b/playbooks/provisioning/openstack/post-provision-openstack.yml index 460c6596b..53db5061c 100644 --- a/playbooks/provisioning/openstack/post-provision-openstack.yml +++ b/playbooks/provisioning/openstack/post-provision-openstack.yml @@ -59,12 +59,14 @@ - name: OpenShift Pre-Requisites hosts: OSEv3 - gather_facts: False + gather_facts: true become: true - tasks: + pre_tasks: - name: "Include DNS configuration to ensure proper name resolution" lineinfile: state: present dest: /etc/sysconfig/network regexp: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" line: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" + roles: + - node-network-manager diff --git a/roles/node-network-manager/tasks/main.yml b/roles/node-network-manager/tasks/main.yml new file mode 100644 index 000000000..6a17855e7 --- /dev/null +++ b/roles/node-network-manager/tasks/main.yml @@ -0,0 +1,22 @@ +--- +- name: install NetworkManager + package: + name: NetworkManager + state: present + +- name: configure NetworkManager + lineinfile: + dest: "/etc/sysconfig/network-scripts/ifcfg-{{ ansible_default_ipv4['interface'] }}" + regexp: '^{{ item }}=' + line: '{{ item }}=yes' + state: present + create: yes + with_items: + - 'USE_PEERDNS' + - 'NM_CONTROLLED' + +- name: enable and start NetworkManager + service: + name: NetworkManager + state: restarted + enabled: yes |