diff --git a/README.md b/README.md index 024ecf7..7b729ad 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,23 @@ -# Unifi-NextDNS +# Unifi-NextDNS: Automated with Ansible + +This repo servers to install/reinstall NextDNS CLI on the UDMP + +### Pre Requisites + +SSH key based authentication must be setup to the UDM. + +### To Use These Playbooks + +Simply clone this repository and follow the readme below. + +### File structure: + +`````` +├── ansible.cfg +├── inventory.yml +└── playbooks + ├── config-nextdns.yml + +`````` + diff --git a/ansible.cfg b/ansible.cfg new file mode 100644 index 0000000..d91952a --- /dev/null +++ b/ansible.cfg @@ -0,0 +1,4 @@ +[defaults] +inventory = ./inventory.yml +host_key_checking = False +#vault_password_file = ./.password_file \ No newline at end of file diff --git a/inventory.yml b/inventory.yml new file mode 100644 index 0000000..83ab9f6 --- /dev/null +++ b/inventory.yml @@ -0,0 +1,8 @@ +all: + children: + UDM: + hosts: + UDMP: + ansible_host: 192.168.1.1 + ansible_user: root + ansible_ssh_private_key_file: ~/.ssh/id_rsa \ No newline at end of file diff --git a/playbooks/config-nextdns.yml b/playbooks/config-nextdns.yml new file mode 100644 index 0000000..0c97285 --- /dev/null +++ b/playbooks/config-nextdns.yml @@ -0,0 +1,21 @@ +--- +- name: Install and Configure NextDNS CLI + hosts: UDM + gather_facts: yes + + tasks: + - name: Download and install NextDNS CLI + ansible.builtin.expect: + command: sh -c 'sh -c "$(curl -sL https://nextdns.io/install)"' + responses: + Question: + - i + - e3448e + - Y + - Y + - Y + + - name: Start NextDNS CLI + ansible.builtin.command: + cmd: nextdns start + ignore_errors: yes \ No newline at end of file