--- - name: Something new hosts: bigboot gather_facts: true vars: bigboot_disabled_services_log: /var/ipe/ipu/el7to8/bigboot_disabled_services.log bigboot_systemd_disabled_services: - docker.service - qemu.service # - foo.service # - bar.service - hi.socket - bob.dole tasks: # - name: Check if disable services log exists # ansible.builtin.stat: # path: "{{ bigboot_disabled_services_log }}" # register: bigboot_disabled_services_log_stat # - name: Remove old disabled services log if present # ansible.builtin.file: # path: "{{ bigboot_disabled_services_log }}" # state: absent # when: # - bigboot_disabled_services_log_stat['stat']['exists'] | bool - name: Get /boot mount information ansible.builtin.set_fact: bigboot_boot_mount: "{{ ansible_facts.mounts \ | selectattr('mount', 'equalto', '/boot') | first }}" # - name: Capture device for /boot # ansible.builtin.set_fact: # bigboot_boot_device: "{{ bigboot_boot_mount['device'] | regex_replace('^.*/(\\w+$)', '\\1') }}" - name: Debug bigboot_boot_mount['device'] ansible.builtin.debug: var: bigboot_boot_mount['device'] - name: Debug bigboot_boot_device[:-1] ansible.builtin.debug: var: bigboot_boot_mount['device'][:-1] - name: Set partition after /boot ansible.builtin.set_fact: bigboot_next_device_int: "{{ bigboot_boot_mount['device'][-1:] | int + 1 }}" - name: Debug bigboot_next_device_int ansible.builtin.debug: var: bigboot_next_device_int - name: What is PV for next ansible.builtin.set_fact: bigboot_pv: "{{ bigboot_boot_mount['device'][:-1] }}{{ bigboot_boot_mount['device'][-1:] | int + 1 }}" - name: Debug bigboot_pv ansible.builtin.debug: var: bigboot_pv - name: Execute hello script ansible.builtin.script: scripts/hello.sh register: foo - name: Debug foo ansible.builtin.debug: var: foo - name: Execute pvsqueeze.sh script ansible.builtin.script: scripts/pvsqueeze.sh /dev/sda2 register: bar - name: Debug bar ansible.builtin.debug: var: bar['stdout_lines'] # - name: Capture partition information from fdisk # ansible.builtin.shell: # cmd: | # set -o pipefail # fdisk -l {{ bigboot_boot_mount['device'][:-1] }} | grep '{{ bigboot_boot_mount['device'][:-1] + (bigboot_boot_mount['device'][-1:] | int + 1) | string }}' # executable: /bin/bash # changed_when: false # failed_when: bigboot_fdisk_partition['rc'] not in [0, 141] # register: bigboot_fdisk_partition # - name: Debug bigboot_fdisk_partition # ansible.builtin.debug: # var: bigboot_fdisk_partition['stdout'] # - name: Assert that the partition following /boot is of type LVM # ansible.builtin.assert: # that: "'Linux LVM' in bigboot_fdisk_partition['stdout']" # success_msg: The partition following /boot is an LVM partition # fail_msg: The partition following /boot is NOT an LVM partition. Execution halted. # - name: Ping # ansible.builtin.debug: # msg: PONG! # - name: Debug bigboot_boot_device[:1] # ansible.builtin.debug: # var: bigboot_boot_mount['device'][-1:] # - name: Log list of services disabled for Bigboot execution - lineinfile # ansible.builtin.lineinfile: # path: "{{ bigboot_disabled_services_log }}" # line: "{{ item }}" # create: true # state: present # owner: root # group: root # mode: "0600" # loop: "{{ bigboot_systemd_disabled_services }}" # - name: Log list of services disabled for Bigboot execution - copy # ansible.builtin.copy: # content: "{{ bigboot_systemd_disabled_services | join('\n') }}" # dest: "{{ bigboot_disabled_services_log2 }}" # owner: root # group: root # mode: "0600" # when: # - bigboot_systemd_disabled_services is defined # - name: Copy something somewhere # ansible.builtin.copy: # src: /root/anaconda-ks.cfg # dest: /tmp/anaconda-ks.cfg # remote_src: true # owner: root # group: root # mode: "0600" # - name: Run a command # ansible.builtin.command: ls -ltr /tmp/anaconda-ks.cfg # changed_when: true # register: boop # - name: Debug boop # ansible.builtin.debug: # var: boop