๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ansible-playbooks/roles/container/tasks/preconf.yml

57 lines
1.8 KiB

2 years ago
- block:
- name: install basic dependencies
include_tasks: tasks/pct_command.yml
vars:
pct_command: "{{ item.pct_command }}"
chg_substr: "{{ item.chg_substr | d(omit) }}"
loop:
- pct_command: apk update
- pct_command: apk add python3
chg_substr: Installing
- pct_command: apk add dropbear
chg_substr: Installing
- pct_command: rc-update add dropbear
chg_substr: added to runlevel
- name: install openssh-sftp-server
2 years ago
include_tasks: tasks/pct_command.yml
vars:
pct_command: apk add openssh-sftp-server
chg_substr: Installing
- name: start dropbear
include_tasks: tasks/pct_command.yml
vars:
pct_command: service dropbear start
chg_substr: \* Starting dropbear ... [ ok ]
when: (container_distro | lower) == 'alpine'
- block:
- name: install basic dependencies
include_tasks: tasks/pct_command.yml
vars:
pct_command: "{{ item.pct_command }}"
chg_substr: "{{ item.chg_substr | default(omit) }}"
loop:
- pct_command: apt-get --assume-yes update
- pct_command: apt-get --assume-yes install python3
chg_substr: The following NEW packages
- pct_command: apt-get --assume-yes install openssh-server
chg_substr: The following NEW packages
- pct_command: systemctl enable ssh.service
chg_substr: Synchronizing state
- name: edit sshd config
include_tasks: tasks/pct_command.yml
vars:
pct_command: "sed -i 's/PermitRootLogin prohibit-password/PermitRootLogin yes/g' /etc/ssh/sshd_config"
- name: start sshd
include_tasks: tasks/pct_command.yml
vars:
pct_command: systemctl start ssh.service
when: (container_distro | lower) in ['debian', 'ubuntu']