generated from the-liberated-edge/wikijs
Migrate code base from lxd to incus
This commit is contained in:
parent
07bbef3c81
commit
74f955cc3d
@ -5,14 +5,14 @@
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: find current container state
|
||||
ansible.builtin.command: lxc ls {{ item.name }}
|
||||
ansible.builtin.command: incus ls {{ item.name }}
|
||||
register: state
|
||||
changed_when: false
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
- name: stop and remove running containers
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
lxc stop {{ item.name }} && \
|
||||
lxc rm {{ item.name }}
|
||||
incus stop {{ item.name }} && \
|
||||
incus rm {{ item.name }}
|
||||
when: state.results[0].rc == 0 and "RUNNING" in state.results[0].stdout
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
|
||||
@ -4,14 +4,14 @@
|
||||
gather_facts: false
|
||||
tasks:
|
||||
- name: find current container state
|
||||
ansible.builtin.command: lxc ls {{ item.name }}
|
||||
ansible.builtin.command: incus ls {{ item.name }}
|
||||
register: state
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
- name: verify launched container is running
|
||||
ansible.builtin.assert:
|
||||
that: state.results[0].rc == 0 and "RUNNING" in state.results[0].stdout
|
||||
- name: find container ip address
|
||||
ansible.builtin.command: lxc ls -c=4 -f=compact {{ item.name }}
|
||||
ansible.builtin.command: incus ls -c=4 -f=compact {{ item.name }}
|
||||
register: ipv4_raw
|
||||
with_items: '{{ molecule_yml.platforms }}'
|
||||
- name: set ipv4 address string as a fact
|
||||
|
||||
@ -1,19 +1,19 @@
|
||||
---
|
||||
- name: find current container state
|
||||
ansible.builtin.command: lxc ls {{ lte_container_name }}
|
||||
ansible.builtin.command: incus ls {{ lte_container_name }}
|
||||
register: container_state
|
||||
changed_when: false
|
||||
- name: launch debian bookworm linux container
|
||||
ansible.builtin.shell:
|
||||
cmd: |
|
||||
lxc launch \
|
||||
incus launch \
|
||||
images:debian/{{ lte_debian_version }}/cloud \
|
||||
{{ lte_container_name }}
|
||||
when: (container_state.rc == 1) or ("RUNNING" not in container_state.stdout)
|
||||
- name: update apt cache and upgrade system packages
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
bash -c \
|
||||
'/usr/bin/apt update && /usr/bin/apt upgrade -y'
|
||||
changed_when: false
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
- name: find systemctl service for openssh-server
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
systemctl status ssh.service
|
||||
register: ssh_service
|
||||
changed_when: false
|
||||
@ -13,14 +13,14 @@
|
||||
- name: install system package openssh-server
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
apt install -y openssh-server
|
||||
register: ssh_pkg
|
||||
when: not ssh_service_exists
|
||||
- name: check openssh server configuration for root access
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
grep -e "^PermitRootLogin yes$" /etc/ssh/sshd_config
|
||||
register: root_access
|
||||
changed_when: false
|
||||
@ -31,7 +31,7 @@
|
||||
- name: configure openssh server to allow root access via ssh
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
sed -i "$ a PermitRootLogin yes" /etc/ssh/sshd_config
|
||||
register: sshd_config
|
||||
when: not ssh_root_login_allowed
|
||||
@ -41,7 +41,7 @@
|
||||
- name: enable openssh server systemd service
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
systemctl enable --now ssh.service
|
||||
when: ssh_pkg_installed
|
||||
- name: set fact sshd_config_touched
|
||||
@ -50,11 +50,11 @@
|
||||
- name: restart openssh server systemd service
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
systemctl restart ssh.service
|
||||
when: sshd_config_touched
|
||||
- name: find container ip address
|
||||
ansible.builtin.command: lxc ls -c=4 -f=compact {{ lte_container_name }}
|
||||
ansible.builtin.command: incus ls -c=4 -f=compact {{ lte_container_name }}
|
||||
register: ipv4
|
||||
changed_when: false
|
||||
when: sshd_config_touched
|
||||
|
||||
@ -2,7 +2,7 @@
|
||||
- name: change root user password in container
|
||||
ansible.builtin.shell:
|
||||
cmd: |-
|
||||
lxc exec {{ lte_container_name }} -- \
|
||||
incus exec {{ lte_container_name }} -- \
|
||||
bash -c \
|
||||
'echo "root:{{ lte_container_root_pwd }}" | chpasswd'
|
||||
changed_when: false
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user