update playbook
This commit is contained in:
parent
20a8d423aa
commit
aa24574319
186
playbook.yml
186
playbook.yml
@ -80,46 +80,40 @@
|
||||
echo "127.0.1.1 {{ serverid }}" >> /etc/hosts
|
||||
changed_when: false
|
||||
|
||||
- name: Update and upgrade apt
|
||||
ansible.builtin.apt:
|
||||
update_cache: true
|
||||
#upgrade: dist
|
||||
#force_apt_get: true
|
||||
#autoremove: true
|
||||
register: apt_update_result
|
||||
retries: 5
|
||||
delay: 50
|
||||
until: apt_update_result is succeeded
|
||||
async: "{{ 60 * 20 }}"
|
||||
poll: 30
|
||||
#- name: Update and upgrade apt
|
||||
# ansible.builtin.apt:
|
||||
# update_cache: true
|
||||
# #upgrade: dist
|
||||
# #force_apt_get: true
|
||||
# #autoremove: true
|
||||
# register: apt_update_result
|
||||
# retries: 5
|
||||
# delay: 50
|
||||
# until: apt_update_result is succeeded
|
||||
# async: "{{ 60 * 20 }}"
|
||||
# poll: 30
|
||||
|
||||
- name: Install packages
|
||||
ansible.builtin.apt:
|
||||
name:
|
||||
- ca-certificates
|
||||
- zlib1g-dev
|
||||
- libncurses5-dev
|
||||
- libgdbm-dev
|
||||
- libnss3-dev
|
||||
- curl
|
||||
- jq
|
||||
- git
|
||||
- zip
|
||||
- wget
|
||||
- make
|
||||
- python3
|
||||
- python3-pip
|
||||
- iftop
|
||||
state: present
|
||||
update_cache: true
|
||||
async: "{{ 60 * 20 }}"
|
||||
poll: 30
|
||||
|
||||
- name: Docker login
|
||||
ansible.builtin.shell: docker login -u "{{ docker_username }}" -p "{{ docker_password }}"
|
||||
register: docker_login_result
|
||||
changed_when: false
|
||||
failed_when: "'Login Succeeded' not in docker_login_result.stdout"
|
||||
#- name: Install packages
|
||||
# ansible.builtin.apt:
|
||||
# name:
|
||||
# - ca-certificates
|
||||
# - zlib1g-dev
|
||||
# - libncurses5-dev
|
||||
# - libgdbm-dev
|
||||
# - libnss3-dev
|
||||
# - curl
|
||||
# - jq
|
||||
# - git
|
||||
# - zip
|
||||
# - wget
|
||||
# - make
|
||||
# - python3
|
||||
# - python3-pip
|
||||
# - iftop
|
||||
# state: present
|
||||
# update_cache: true
|
||||
# async: "{{ 60 * 20 }}"
|
||||
# poll: 30
|
||||
|
||||
- name: Clone repository
|
||||
ansible.builtin.git:
|
||||
@ -130,60 +124,48 @@
|
||||
async: "{{ 60 * 15 }}"
|
||||
poll: 30
|
||||
|
||||
- name: Install grist-api and colorama (attempt 1)
|
||||
ansible.builtin.command: pip3 install grist-api colorama --break-system-packages
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/node"
|
||||
#- name: Install grist-api and colorama (attempt 1)
|
||||
# ansible.builtin.command: pip3 install grist-api colorama --break-system-packages
|
||||
# args:
|
||||
# chdir: "{{ ansible_env.HOME }}/node"
|
||||
# changed_when: false
|
||||
|
||||
#- name: Install Docker
|
||||
# ansible.builtin.shell: curl -fsSL https://get.docker.com | bash
|
||||
# changed_when: false
|
||||
# async: "{{ 60 * 5 }}"
|
||||
# poll: 30
|
||||
|
||||
#- name: Update Docker daemon journald logging
|
||||
# ansible.builtin.copy:
|
||||
# dest: /etc/docker/daemon.json
|
||||
# content: |
|
||||
# { "log-driver": "journald" }
|
||||
# mode: '0644'
|
||||
|
||||
- name: Docker login
|
||||
ansible.builtin.shell: docker login -u "{{ docker_username }}" -p "{{ docker_password }}"
|
||||
register: docker_login_result
|
||||
changed_when: false
|
||||
register: pip_install_1
|
||||
ignore_errors: true
|
||||
failed_when: "'Login Succeeded' not in docker_login_result.stdout"
|
||||
|
||||
- name: Install grist-api and colorama (attempt 2)
|
||||
ansible.builtin.command: pip3 install grist-api colorama --break-system-packages
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/node"
|
||||
changed_when: false
|
||||
register: pip_install_2
|
||||
ignore_errors: true
|
||||
when: pip_install_1 is failed
|
||||
#- name: Restart Docker
|
||||
# ansible.builtin.service:
|
||||
# name: docker
|
||||
# state: restarted
|
||||
|
||||
- name: Install grist-api and colorama (attempt 3)
|
||||
ansible.builtin.command: pip3 install grist-api colorama --break-system-packages
|
||||
args:
|
||||
chdir: "{{ ansible_env.HOME }}/node"
|
||||
changed_when: false
|
||||
when: pip_install_1 is failed and pip_install_2 is failed
|
||||
|
||||
- name: Install Docker
|
||||
ansible.builtin.shell: curl -fsSL https://get.docker.com | bash
|
||||
changed_when: false
|
||||
async: "{{ 60 * 5 }}"
|
||||
poll: 30
|
||||
#- name: Update journald log SystemMaxUse=2G configuration
|
||||
# ansible.builtin.lineinfile:
|
||||
# path: /etc/systemd/journald.conf
|
||||
# line: 'SystemMaxUse=2G'
|
||||
# insertafter: EOF
|
||||
# create: true
|
||||
# mode: '0644'
|
||||
|
||||
- name: Update Docker daemon journald logging
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/docker/daemon.json
|
||||
content: |
|
||||
{ "log-driver": "journald" }
|
||||
mode: '0644'
|
||||
|
||||
- name: Restart Docker
|
||||
ansible.builtin.service:
|
||||
name: docker
|
||||
state: restarted
|
||||
|
||||
- name: Update journald log SystemMaxUse=2G configuration
|
||||
ansible.builtin.lineinfile:
|
||||
path: /etc/systemd/journald.conf
|
||||
line: 'SystemMaxUse=2G'
|
||||
insertafter: EOF
|
||||
create: true
|
||||
mode: '0644'
|
||||
|
||||
- name: Restart journald
|
||||
ansible.builtin.service:
|
||||
name: systemd-journald
|
||||
state: restarted
|
||||
#- name: Restart journald
|
||||
# ansible.builtin.service:
|
||||
# name: systemd-journald
|
||||
# state: restarted
|
||||
|
||||
- name: Make update.sh executable
|
||||
ansible.builtin.shell: |
|
||||
@ -220,20 +202,20 @@
|
||||
fail_msg: "The returned value is not a valid IP address."
|
||||
success_msg: "The returned value is a valid IP address."
|
||||
|
||||
- name: Download tun2socks
|
||||
ansible.builtin.get_url:
|
||||
url: https://github.com/xjasonlyu/tun2socks/releases/download/v2.5.2/tun2socks-linux-amd64.zip
|
||||
dest: /tmp/tun2socks-linux-amd64.zip
|
||||
mode: '0644'
|
||||
async: "{{ 60 * 5 }}"
|
||||
poll: 30
|
||||
#- name: Download tun2socks
|
||||
# ansible.builtin.get_url:
|
||||
# url: https://github.com/xjasonlyu/tun2socks/releases/download/v2.5.2/tun2socks-linux-amd64.zip
|
||||
# dest: /tmp/tun2socks-linux-amd64.zip
|
||||
# mode: '0644'
|
||||
# async: "{{ 60 * 5 }}"
|
||||
# poll: 30
|
||||
|
||||
- name: Unzip tun2socks
|
||||
ansible.builtin.unarchive:
|
||||
src: /tmp/tun2socks-linux-amd64.zip
|
||||
dest: /usr/local/sbin/
|
||||
remote_src: true
|
||||
mode: '0755'
|
||||
#- name: Unzip tun2socks
|
||||
# ansible.builtin.unarchive:
|
||||
# src: /tmp/tun2socks-linux-amd64.zip
|
||||
# dest: /usr/local/sbin/
|
||||
# remote_src: true
|
||||
# mode: '0755'
|
||||
|
||||
- name: Create proxy file
|
||||
ansible.builtin.copy:
|
||||
|
Loading…
Reference in New Issue
Block a user