diff --git a/playbook.yml b/playbook.yml index 8fcd1d3..345b8e5 100644 --- a/playbook.yml +++ b/playbook.yml @@ -60,10 +60,16 @@ marker: "" mode: '0644' - - name: Set hostname - ansible.builtin.shell: | - hostnamectl set-hostname {{ serverid }} - echo "127.0.1.1 {{ serverid }}" >> /etc/hosts + - name: Set hostname + ansible.builtin.hostname: + name: "{{ serverid }}" + + - name: Ensure hostname is in /etc/hosts + ansible.builtin.lineinfile: + path: /etc/hosts + regexp: '^127\.0\.1\.1\s+' + line: "127.0.1.1 {{ serverid }}" + state: present - name: Update and upgrade apt ansible.builtin.apt: @@ -71,9 +77,7 @@ upgrade: dist force_apt_get: true register: apt_update_result - retries: 50 - delay: 50 - until: apt_update_result is succeeded + until: apt_update_result is success - name: Install necessary packages ansible.builtin.apt: @@ -100,7 +104,6 @@ dest: /etc/docker/daemon.json content: | { "log-driver": "journald" } - marker: "" - name: Restart Docker ansible.builtin.service: @@ -113,11 +116,11 @@ - name: Update journald log SystemMaxUse=2G configuration ansible.builtin.lineinfile: path: /etc/systemd/journald.conf + regexp: '^SystemMaxUse=' line: 'SystemMaxUse=2G' - insertafter: EOF - create: true - marker: "" - mode: '0644' + state: present + backup: yes + validate: 'journaldctl check-config %s' - name: Restart journald ansible.builtin.service: @@ -178,7 +181,7 @@ chdir: "{{ ansible_env.HOME }}/ritual" retries: 2 delay: 60 - failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_output.stdout' + failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_deploy_output.stdout' - name: Update CallContract.s.sol with contract address ansible.builtin.shell: | @@ -190,12 +193,12 @@ - name: Call contract ansible.builtin.shell: project=hello-world make call-contract 2>&1 - register: contract_output + register: contract_call_output args: chdir: "{{ ansible_env.HOME }}/ritual" retries: 2 delay: 60 - failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_output.stdout' + failed_when: '"ONCHAIN EXECUTION COMPLETE & SUCCESSFUL" not in contract_call_output.stdout' - name: Set Docker containers to restart unless stopped ansible.builtin.shell: |