From 0fbb337bf755b84e52f9ec188d3d9dddb7c1ab47 Mon Sep 17 00:00:00 2001 From: Jon Nordby Date: Fri, 16 Nov 2018 15:53:56 +0100 Subject: [PATCH] ansible: Add mobile-network role --- .../lindeberg/mobile-network-secrets.yml | 6 ++++++ ansible/hosts | 4 +++- ansible/roles/mobile-network/tasks/main.yml | 18 ++++++++++++++++++ 3 files changed, 27 insertions(+), 1 deletion(-) create mode 100644 ansible/group_vars/lindeberg/mobile-network-secrets.yml create mode 100644 ansible/roles/mobile-network/tasks/main.yml diff --git a/ansible/group_vars/lindeberg/mobile-network-secrets.yml b/ansible/group_vars/lindeberg/mobile-network-secrets.yml new file mode 100644 index 0000000..6ada214 --- /dev/null +++ b/ansible/group_vars/lindeberg/mobile-network-secrets.yml @@ -0,0 +1,6 @@ +$ANSIBLE_VAULT;1.1;AES256 +31646233396336366133343534626638643135373838666237393535653239343731616431623966 +3438663866316165623961326562303439363639373936660a666639353165656361333862356338 +32616233343139376335313666663066363338366165346538666133373837383163333231633261 +3330376230333538380a626566393433656239636664393030323231396233353431373031663732 +66666165376564643532663762653266306138363433353831313639643761313861 diff --git a/ansible/hosts b/ansible/hosts index b45a5f8..5178501 100644 --- a/ansible/hosts +++ b/ansible/hosts @@ -20,6 +20,9 @@ dlock-13 ansible_host=door13.dlock.trygvis.io [gateways] dlock +[lindeberg] +dlock-7 + [doors] dlock-dev dlock-0 @@ -29,7 +32,6 @@ dlock-3 dlock-4 dlock-5 dlock-6 -dlock-7 dlock-8 dlock-9 dlock-10 diff --git a/ansible/roles/mobile-network/tasks/main.yml b/ansible/roles/mobile-network/tasks/main.yml new file mode 100644 index 0000000..ac32cfe --- /dev/null +++ b/ansible/roles/mobile-network/tasks/main.yml @@ -0,0 +1,18 @@ +--- +- name: Mobile network connection + tags: mobile-network + block: + - name: Install system dependencies + apt: + name: + - network-manager + - modemmanager + - python-dbus + - gir1.2-networkmanager-1.0 + - name: Add NetworkManager connection + shell: "nmcli connection show mobile || nmcli connection add con-name mobile type gsm ifname '*' apn {{mobile_network_apn}}" + - name: Configure connection + command: "nmcli connection modify mobile connection.autoconnect yes connection.autoconnect-retries 1000 gsm.pin {{mobile_network_pin}} gsm.number {{mobile_network_number}}" + - name: Set connection as up + command: "nmcli connection up mobile" + ignore_errors: yes # will happen if GSM modem not plugged in