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