diff --git a/README.md b/README.md index e1bef87..b621747 100644 --- a/README.md +++ b/README.md @@ -156,6 +156,14 @@ ansible-playbook networking.yml After running the playbook, until a reboot, the Pis will still be accessible over their former DHCP-assigned IP address. After rebooting, the nodes will be accessible on their new IP addresses. +You can reboot all the nodes with: + +``` +ansible all -m reboot -b +``` + +> If you are running Ubuntu, and you get an error like `"Failed to find required executable "nmcli"`, run the `ubuntu-setup.yml` playbook: `ansible-playbook tasks/networking/ubuntu-prep.yml` + #### If using a different subnet If you chose a different subnet than your LAN, make sure your workstation is connected to an interface on the same subnet as the cluster (e.g. `10.1.1.x`). diff --git a/example.config.yml b/example.config.yml index f8d9267..a9ee035 100644 --- a/example.config.yml +++ b/example.config.yml @@ -19,7 +19,9 @@ drupal_extra_settings_php: '' # remote networking features in the `tasks/networking` playbooks. ipv4_subnet_prefix: "10.1.1" ipv4_gateway: "10.1.1.1" +dns4_servers: "{{ ipv4_gateway }}" active_internet_interface: "wlan0" reverse_tunnel_enable: false reverse_tunnel_vps_username: my-vps-username reverse_tunnel_vps_hostname: my-vps-hostname +control_plane_router_setup: false diff --git a/networking.yml b/networking.yml index b15849a..1ba69bb 100644 --- a/networking.yml +++ b/networking.yml @@ -8,3 +8,4 @@ - name: Configure control plane as a router. import_playbook: tasks/networking/router.yml + when: control_plane_router_setup diff --git a/tasks/networking/static-networking.yml b/tasks/networking/static-networking.yml index 127769c..5c7f044 100644 --- a/tasks/networking/static-networking.yml +++ b/tasks/networking/static-networking.yml @@ -43,6 +43,7 @@ type: ethernet ip4: "{{ ipv4_subnet_prefix }}.{{ ip_host_octet }}/24" gw4: "{{ ipv4_gateway }}" + dns4: "{{ dns4_servers }}" state: present notify: restart networkmanager when: not dhcpcd_file_result.stat.exists diff --git a/tasks/networking/ubuntu-prep.yml b/tasks/networking/ubuntu-prep.yml new file mode 100644 index 0000000..b0ad9a2 --- /dev/null +++ b/tasks/networking/ubuntu-prep.yml @@ -0,0 +1,34 @@ +--- +- name: Prepare Ubuntu for static networking. + hosts: cluster + gather_facts: false + become: true + + vars: + netplan_file: /etc/netplan/50-cloud-init.yaml + + tasks: + - name: Ensure NetworkManager is installed. + ansible.builtin.apt: + name: network-manager + state: present + update_cache: true + + - name: Configure netplan file for NetworkManager. + ansible.builtin.copy: + dest: "{{ netplan_file }}" + mode: 0600 + content: | + # ANSIBLE MANAGED - netplan configuration + network: + version: 2 + renderer: NetworkManager + + - name: Regenerate netplan config. + ansible.builtin.command: "{{ item }}" + with_items: + - sudo netplan generate + - sudo netplan apply + + - name: Reboot. + ansible.builtin.reboot: diff --git a/tasks/storage/filesystem.yml b/tasks/storage/filesystem.yml index 810c193..6e62976 100644 --- a/tasks/storage/filesystem.yml +++ b/tasks/storage/filesystem.yml @@ -3,7 +3,7 @@ ansible.builtin.file: dest: "/{{ storage_nfs_dir }}/{{ storage_nfs_share_name }}" owner: root - group: pi + group: "{{ ansible_user }}" state: directory mode: 0777