Commit 13376234 authored by Jérome Perrin's avatar Jérome Perrin

playbook: make it possible to run playbook when apt repository is broken

See merge request nexedi/slapos.package!179
parents e9b7d5f8 f54f72cf
Pipeline #27176 failed with stage
in 0 seconds
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
register: gitignore_file register: gitignore_file
- name: Install git - name: Install git
apt: name=git state=latest update_cache=no apt: name=git state=latest
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Install git - name: Install git
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
when: ansible_os_family == "RedHat" when: ansible_os_family == "RedHat"
- name: Install etckeeper - name: Install etckeeper
apt: name=etckeeper state=latest update_cache=no apt: name=etckeeper state=latest
when: ansible_os_family == "Debian" when: ansible_os_family == "Debian"
- name: Install etckeeper - name: Install etckeeper
......
- name: Install {{ package_name }} using apt - name: Try to update apt cache
apt: name={{ package_name }} state={{ package_state }} update_cache=yes cache_valid_time=3600 apt: update_cache=yes cache_valid_time=3600
when: ansible_os_family == "Debian" or ansible_os_family == "Linuxmint" or ansible_os_family == "Kylin" when: ansible_os_family == "Debian" or ansible_os_family == "Linuxmint" or ansible_os_family == "Kylin"
ignore_errors: true
- name: Install {{ package_name }} (latest) using apt
# We use update_cache=yes without ignoring errors (Unlike the "Try to update apt cache" task above),
# because if `latest` package is requested it is an error if we can not update the cache.
apt: name={{ package_name }} state={{ package_state }} update_cache=yes cache_valid_time=3600
when: package_state == "latest" and ansible_os_family == "Debian" or ansible_os_family == "Linuxmint" or ansible_os_family == "Kylin"
- name: Install {{ package_name }} using apt
apt: name={{ package_name }} state={{ package_state }}
when: package_state != "latest" and ansible_os_family == "Debian" or ansible_os_family == "Linuxmint" or ansible_os_family == "Kylin"
- name: Install {{ package_name }} using yum - name: Install {{ package_name }} using yum
yum: name={{ package_name }} state={{ package_state }} update_cache=yes yum: name={{ package_name }} state={{ package_state }} update_cache=yes
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
command: apt-get update -y --allow-releaseinfo-change command: apt-get update -y --allow-releaseinfo-change
when: (ansible_distribution == "Debian" and ansible_distribution_major_version|int > 9) or when: (ansible_distribution == "Debian" and ansible_distribution_major_version|int > 9) or
(ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int > 18) (ansible_distribution == "Ubuntu" and ansible_distribution_major_version|int > 18)
ignore_errors: true
- name: Install gpg using apt - name: Install gpg using apt
apt: name=gpg state=present apt: name=gpg state=present
......
--- ---
dependencies: dependencies:
- { role: repository, when: not slapos_ansible_offline} - { role: repository, when: not slapos_ansible_offline}
- { role: package, package_name: slapos-node, package_state: present, when: ansible_distribution != "CentOS"}
...@@ -10,15 +10,11 @@ ...@@ -10,15 +10,11 @@
state: directory state: directory
mode: 0755 mode: 0755
- name: Install packages using apt
apt: name=slapos-node state=present update_cache=yes cache_valid_time=3600
when: ansible_os_family == "Debian" and not slapos_ansible_offline
- name: Uninstall firewalld on CentOS - name: Uninstall firewalld on CentOS
yum: name=firewalld state=absent update_cache=yes yum: name=firewalld state=absent update_cache=yes
when: ansible_distribution == "CentOS" when: ansible_distribution == "CentOS"
- name: Install re6stnet on CentOS - name: Install slapos-node on CentOS
yum: name=slapos.node state=present update_cache=yes yum: name=slapos.node state=present update_cache=yes
when: ansible_distribution == "CentOS" and ansible_distribution_major_version != "7" and not slapos_ansible_offline when: ansible_distribution == "CentOS" and ansible_distribution_major_version != "7" and not slapos_ansible_offline
...@@ -29,7 +25,7 @@ ...@@ -29,7 +25,7 @@
checksum: "md5:37446cc16b38fa5769f3e084294c8683" checksum: "md5:37446cc16b38fa5769f3e084294c8683"
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" and not slapos_ansible_offline when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" and not slapos_ansible_offline
- name: Install re6stnet on CentOS 7 - name: Install slapos-node on CentOS 7
yum: name=/tmp/slapos.node-1.0.56-2.1.x86_64.rpm state=present update_cache=yes yum: name=/tmp/slapos.node-1.0.56-2.1.x86_64.rpm state=present update_cache=yes
when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" and not slapos_ansible_offline when: ansible_distribution == "CentOS" and ansible_distribution_major_version == "7" and not slapos_ansible_offline
......
--- ---
- name: Install Debian Jessie repository for Debian 9 for gcc-4.9 - name: Install Debian Jessie repository for Debian 9 for gcc-4.9
apt_repository: repo='deb http://ftp.us.debian.org/debian/ jessie main contrib non-free' state=present update_cache=no apt_repository: repo='deb http://ftp.us.debian.org/debian/ jessie main contrib non-free' state=present
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9" when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9"
- name: Update repos for debian 9 - name: Update repos for debian 9
...@@ -8,11 +8,11 @@ ...@@ -8,11 +8,11 @@
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9" when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9"
- name: Install gcc-4.9 on Debian 9 - name: Install gcc-4.9 on Debian 9
apt: name=gcc-4.9 state=present update_cache=yes cache_valid_time=3600 apt: name=gcc-4.9 state=present
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9" when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9"
- name: Install g++-4.9 on Debian 9 - name: Install g++-4.9 on Debian 9
apt: name=g++-4.9 state=present update_cache=yes cache_valid_time=3600 apt: name=g++-4.9 state=present
when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9" when: ansible_distribution == "Debian" and ansible_distribution_major_version == "9"
- name: Default to cpp-4.9 - name: Default to cpp-4.9
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment