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.

54 lines
1.4 KiB

---
- name: Enable services on installed system.
command: arch-chroot {{ root_mount }}
systemctl enable {{ item }}
with_items:
- sshd
- NetworkManager
- fstrim.timer
changed_when: true
- name: Get primary network interface.
set_fact:
net_interface: '{{ ansible_interfaces | reject("match", "^lo$") | first }}'
- name: Set ip address.
set_fact:
net_ip: '{{ ansible_facts[net_interface]["ipv4"]["address"] }}'
- name: Set gateway.
set_fact:
net_gateway: '{{ (ansible_facts[net_interface]["ipv4"]["network"] | split("."))[:3] | join(".") }}.1'
- name: Set nameservers.
set_fact:
net_dns: '{{ ansible_facts["dns"]["nameservers"] | join(";") }};8.8.8.8;'
- name: Create static ip config.
template:
src: files/static.nmconnection
dest: "{{ root_mount }}/etc/NetworkManager/system-connections/static.nmconnection"
owner: root
group: root
mode: 0600
- name: Make sure root's .ssh directory exists.
file:
state: directory
path: "{{ root_mount }}/root/.ssh"
owner: root
group: root
mode: 0700
3 years ago
- name: Make sure temporary key is in root's authorized_keys.
authorized_key:
state: present
user: root
path: "{{ root_mount }}/root/.ssh/authorized_keys"
key: "{{ tmp_pub_key }}"
manage_dir: true
- name: Update root password.
command: arch-chroot {{ root_mount }} sh -c "echo root:{{ root_user_password }} | chpasswd"
changed_when: true