]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ansible: Bring ceph-build playbooks up to date with prado
authorDavid Galloway <dgallowa@redhat.com>
Thu, 19 Oct 2017 13:35:10 +0000 (09:35 -0400)
committerDavid Galloway <dgallowa@redhat.com>
Fri, 20 Oct 2017 18:51:39 +0000 (14:51 -0400)
The playbooks on prado.ceph.com have been manually manipulated a few
times but didn't get updated in ceph-build.git.  This commit mainly
includes:

 - Support for multiple Jenkins masters
 - Using Google DNS instead of OVH's (due to random DNS failures)

Signed-off-by: David Galloway <dgallowa@redhat.com>
ansible/slave.yml
ansible/slave_libvirt.yml

index 3311457c0157b54cb958cb346d00b6dcf530be7b..f83576471d38c9eff18f689b7f19ff8660000f3c 100644 (file)
@@ -9,11 +9,46 @@
    - api_user: 'ceph-jenkins'
    - token: '{{ token }}'
    - api_uri: 'https://jenkins.ceph.com'
+   - jenkins_credentials_uuid: '39fa150b-b2a1-416e-b334-29a9a2c0b32d'
    - nodename: '{{ nodename }}'
    - labels: '{{ labels }}'
    - use_jnlp: false
 
   tasks:
+    - name: uninstall resolvconf on Ubuntu to manually manage resolv.conf
+      apt:
+        name: resolvconf
+        state: absent
+      when: ansible_os_family == "Debian"
+
+    - name: check for NetworkManager conf
+      stat:
+        path: /etc/NetworkManager/NetworkManager.conf
+      register: nm_conf
+
+    - name: tell NetworkManager to leave resolv.conf alone on CentOS
+      lineinfile:
+        dest: /etc/NetworkManager/NetworkManager.conf
+        regexp: '^dns='
+        line: 'dns=none'
+        state: present
+      when: ansible_os_family == "RedHat" and nm_conf.stat.exists
+
+    - name: tell dhclient to leave resolv.conf alone on Ubuntu
+      lineinfile:
+        dest: /etc/dhcp/dhclient.conf
+        regexp: 'prepend domain-name-servers'
+        line: 'supersede domain-name-servers 8.8.8.8;'
+        state: present
+      when: ansible_os_family == "Debian"
+
+    - name: use Google DNS for name resolution
+      lineinfile:
+        dest: /etc/resolv.conf
+        regexp: '^nameserver'
+        line: 'nameserver 8.8.8.8'
+        state: present
+
     - name: create a {{ jenkins_user }} user
       user: name={{ jenkins_user }} comment="Jenkins Build Slave User"
 
         name: "{{ ansible_default_ipv4.address }}+{{ nodename }}"
         labels: "{{ labels }}"
         host: "{{ ansible_default_ipv4.address }}"
-        credentialsId: '39fa150b-b2a1-416e-b334-29a9a2c0b32d'
+        credentialsId: "{{ jenkins_credentials_uuid }}"
         remoteFS: '/home/{{ jenkins_user }}/build'
         executors: '{{ executors|default(1) }}'
         exclusive: true
         name: "{{ ansible_default_ipv4.address }}+{{ nodename }}"
         labels: "{{ labels }}"
         host: "{{ ansible_default_ipv4.address }}"
-        credentialsId: '39fa150b-b2a1-416e-b334-29a9a2c0b32d'
+        credentialsId: "{{ jenkins_credentials_uuid }}"
         launcher: 'hudson.slaves.JNLPLauncher'
         remoteFS: '/home/{{ jenkins_user }}/build'
         # XXX this should be configurable, not all nodes should have one executor
index 64f12e0ecc1ca2c4fcd4e34f33dc466bc2d8e053..a8f64c55511894ad54660d4561ee3e81c10ec038 100644 (file)
@@ -9,11 +9,45 @@
    - api_user: 'ceph-jenkins'
    - token: '{{ token }}'
    - api_uri: 'https://jenkins.ceph.com'
+   - jenkins_credentials_uuid: '39fa150b-b2a1-416e-b334-29a9a2c0b32d'
    - nodename: '{{ nodename }}'
    - labels: '{{ labels }}'
    - use_jnlp: false
 
   tasks:
+    - name: uninstall resolvconf on Ubuntu to manually manage resolv.conf
+      apt:
+        name: resolvconf
+        state: absent
+      when: ansible_os_family == "Debian"
+
+    - name: check for NetworkManager conf
+      stat:
+        path: /etc/NetworkManager/NetworkManager.conf
+      register: nm_conf
+
+    - name: tell NetworkManager to leave resolv.conf alone on CentOS
+      lineinfile:
+        dest: /etc/NetworkManager/NetworkManager.conf
+        regexp: '^dns='
+        line: 'dns=none'
+        state: present
+      when: ansible_os_family == "RedHat" and nm_conf.stat.exists
+
+    - name: tell dhclient to leave resolv.conf alone on Ubuntu
+      lineinfile:
+        dest: /etc/dhcp/dhclient.conf
+        regexp: 'prepend domain-name-servers'
+        line: 'supersede domain-name-servers 8.8.8.8;'
+        state: present
+      when: ansible_os_family == "Debian"
+
+    - name: use Google DNS for name resolution
+      lineinfile:
+        dest: /etc/resolv.conf
+        regexp: '^nameserver'
+        line: 'nameserver 8.8.8.8'
+        state: present
 
     # vagrant doesn't have repositories, this chacra repo will be better to have
     # around and can get updates as soon as a new vagrant version is published via
@@ -54,7 +88,7 @@
 
     - set_fact:
         jenkins_group: 'libvirt'
-      when: ansible_distribution_version == '16.10'
+      when: ansible_distribution_version == '17.04'
 
     - name: create a {{ jenkins_user }} user
       user:
       when:
         ansible_distribution_release in ['precise', 'trusty', 'wheezy', 'jessie']
 
-    - name: Install default openjdk for Xenial only
+    - name: Install default openjdk for Xenial or Zesty
       apt: name={{ item }} state=present
       with_items:
         - default-jdk
         - default-jre
       when:
-        ansible_distribution_release == 'xenial'
+        ansible_distribution_release in ['xenial', 'zesty']
 
     - name: correct java version selected
       alternatives: name=java path=/usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
         name: "{{ ansible_default_ipv4.address }}+{{ nodename }}"
         labels: "{{ labels }}"
         host: "{{ ansible_default_ipv4.address }}"
-        credentialsId: '39fa150b-b2a1-416e-b334-29a9a2c0b32d'
+        credentialsId: "{{ jenkins_credentials_uuid }}"
         remoteFS: '/home/{{ jenkins_user }}/build'
         executors: '{{ executors|default(1) }}'
         exclusive: true
         name: "{{ ansible_default_ipv4.address }}+{{ nodename }}"
         labels: "{{ labels }}"
         host: "{{ ansible_default_ipv4.address }}"
-        credentialsId: '39fa150b-b2a1-416e-b334-29a9a2c0b32d'
+        credentialsId: "{{ jenkins_credentials_uuid }}"
         launcher: 'hudson.slaves.JNLPLauncher'
         remoteFS: '/home/{{ jenkins_user }}/build'
         # XXX this should be configurable, not all nodes should have one executor