Fix some ansible-lint complaints.
This commit is contained in:
parent
c7030c9245
commit
2cf34e8e55
64 changed files with 357 additions and 297 deletions
|
@ -2,8 +2,8 @@
|
|||
##
|
||||
## Port mapping to the host:
|
||||
##
|
||||
## container 0: ssh → host port 10000, HTTP → 10100
|
||||
## container 1: ssh → host port 10001, HTTP → 10101
|
||||
## container 0: ssh → host port 10000, HTTP → 10100
|
||||
## container 1: ssh → host port 10001, HTTP → 10101
|
||||
## ... ... ...
|
||||
##
|
||||
## User '{{ contuser }}' in the sudo group. Password is '{{ contpwd }}'.
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
name:
|
||||
- systemd-container
|
||||
- debootstrap
|
||||
state: latest
|
||||
state: latest # noqa package-latest
|
||||
|
||||
- name: prepare machine directory
|
||||
file:
|
||||
|
@ -23,7 +23,7 @@
|
|||
args:
|
||||
chdir: /var/lib/machines/
|
||||
creates: /var/lib/machines/{{ contname }}00
|
||||
environment:
|
||||
environment:
|
||||
http_proxy: "{{ '' if run_in_installer|default(false) else 'http://localhost:3142' }}"
|
||||
notify: enable and restart containers
|
||||
|
||||
|
@ -31,7 +31,8 @@
|
|||
copy:
|
||||
src: /etc/apt/sources.list
|
||||
dest: /var/lib/machines/{{ contname }}00/etc/apt/sources.list
|
||||
remote_src: yes
|
||||
mode: 0644
|
||||
remote_src: true
|
||||
|
||||
- name: configure locale
|
||||
lineinfile:
|
||||
|
@ -57,7 +58,7 @@
|
|||
- name: provide {{ contuser }} user account
|
||||
command:
|
||||
cmd: >
|
||||
chroot . sh -c '/usr/sbin/useradd -m -s /bin/bash
|
||||
chroot . sh -c '/usr/sbin/useradd -m -s /bin/bash
|
||||
-c "User {{ contuser }},,," -G sudo {{ contuser }}'
|
||||
args:
|
||||
chdir: /var/lib/machines/{{ contname }}00
|
||||
|
@ -89,6 +90,7 @@
|
|||
file:
|
||||
path: /var/lib/machines/{{ contname }}00/etc/systemd/system/{{ item }}
|
||||
state: directory
|
||||
mode: 0755
|
||||
loop:
|
||||
- multi-user.target.wants
|
||||
- sockets.target.wants
|
||||
|
@ -100,13 +102,17 @@
|
|||
src: /lib/systemd/system/{{ item.src }}
|
||||
dest: /var/lib/machines/{{ contname }}00/etc/systemd/system/{{ item.dest }}
|
||||
state: link
|
||||
follow: False
|
||||
force: yes
|
||||
follow: false
|
||||
force: true
|
||||
loop:
|
||||
- { src: systemd-networkd.service, dest: dbus-org.freedesktop.network1.service }
|
||||
- { src: systemd-networkd.service, dest: multi-user.target.wants/systemd-networkd.service }
|
||||
- { src: systemd-networkd.socket, dest: sockets.target.wants/systemd-networkd.socket }
|
||||
- { src: systemd-networkd-wait-online.service, dest: network-online.target.wants/systemd-networkd-wait-online.service }
|
||||
- src: systemd-networkd.service
|
||||
dest: dbus-org.freedesktop.network1.service
|
||||
- src: systemd-networkd.service
|
||||
dest: multi-user.target.wants/systemd-networkd.service
|
||||
- src: systemd-networkd.socket
|
||||
dest: sockets.target.wants/systemd-networkd.socket
|
||||
- src: systemd-networkd-wait-online.service
|
||||
dest: network-online.target.wants/systemd-networkd-wait-online.service
|
||||
notify: enable and restart containers
|
||||
|
||||
- name: enable systemd-resolved in containers
|
||||
|
@ -114,11 +120,13 @@
|
|||
src: /lib/systemd/system/{{ item.src }}
|
||||
dest: /var/lib/machines/{{ contname }}00/etc/systemd/system/{{ item.dest }}
|
||||
state: link
|
||||
follow: False
|
||||
force: yes
|
||||
follow: false
|
||||
force: true
|
||||
loop:
|
||||
- { src: systemd-resolved.service, dest: dbus-org.freedesktop.resolve1.service }
|
||||
- { src: systemd-resolved.service, dest: multi-user.target.wants/systemd-resolved.service }
|
||||
- src: systemd-resolved.service
|
||||
dest: dbus-org.freedesktop.resolve1.service
|
||||
- src: systemd-resolved.service
|
||||
dest: multi-user.target.wants/systemd-resolved.service
|
||||
notify: enable and restart containers
|
||||
|
||||
########
|
||||
|
@ -126,7 +134,8 @@
|
|||
copy:
|
||||
content: "# Avoid 'too many open files' error:"
|
||||
dest: /etc/sysctl.d/inotify.conf
|
||||
force: no
|
||||
mode: 0644
|
||||
force: false
|
||||
|
||||
- name: fix too many open files error
|
||||
sysctl:
|
||||
|
@ -146,11 +155,13 @@
|
|||
file:
|
||||
path: /etc/systemd/nspawn
|
||||
state: directory
|
||||
mode: 0755
|
||||
|
||||
- name: provide container configuration
|
||||
template:
|
||||
src: contcfg.nspawn.j2
|
||||
dest: /etc/systemd/nspawn/{{ contname}}{{ "%02d" | format(item|int) }}.nspawn
|
||||
dest: /etc/systemd/nspawn/{{ contname }}{{ "%02d" | format(item|int) }}.nspawn
|
||||
mode: 0644
|
||||
loop: "{{ containers }}"
|
||||
notify: enable and restart containers
|
||||
|
||||
|
@ -158,6 +169,7 @@
|
|||
template:
|
||||
src: hostname.j2
|
||||
dest: /var/lib/machines/{{ contname }}{{ "%02d" | format(item|int) }}.hostname
|
||||
mode: 0644
|
||||
loop: "{{ containers }}"
|
||||
notify: enable and restart containers
|
||||
|
||||
|
@ -165,5 +177,6 @@
|
|||
template:
|
||||
src: hosts.j2
|
||||
dest: /var/lib/machines/{{ contname }}{{ "%02d" | format(item|int) }}.hosts
|
||||
mode: 0644
|
||||
loop: "{{ containers }}"
|
||||
notify: enable and restart containers
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue