Skip to content

Commit

Permalink
Added /etc/shadow generation
Browse files Browse the repository at this point in the history
  • Loading branch information
nemesifier committed Dec 2, 2016
1 parent 945a5d6 commit 799e982
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -103,16 +103,18 @@ Create a new playbook file `playbook.yml` **on your local machine** with the fol
flavours: # supported flavours
- standard
luci_openwisp: # /etc/config/luci_openwisp
# other config keys can be added freely
username: "operator"
# "password" string encrypted
password: "$1$openwisp$iQpdG2IrO4lya98cODuUB/"
salt: "openwisp"
# other config keys can be added freely
openwisp: # /etc/config/openwisp
# other config keys can be added freely
url: "https://my-openwisp2-instance.com"
secret: "my-openwisp2-secret"
unmanaged: "{{ openwisp2fw_default_unmanaged }}"
# other config keys can be added freely
# encrypted password that will be put in /etc/shadow
root_password: "$1$8YoE5Fl2$N49pL.Pa.6/fZ/E/f/afw/" # encrypted version of "myPassword"
```
This playbook will let you compile firmware images for an organization named `snakeoil` using only the `standard` flavour (which includes a default OpenWRT image with the standard OpenWISP2 modules) for two architectures, ar71xx and x86.
Expand Down
8 changes: 8 additions & 0 deletions tasks/3-generator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,14 @@
with_items: "{{ openwisp2fw_organizations }}"
when: item.luci_openwisp

- name: /etc/shadow
template:
dest: "{{ openwisp2fw_generator_dir }}/files/{{ item.name }}/etc/shadow"
src: generator/shadow.jinja2
mode: 0600
with_items: "{{ openwisp2fw_organizations }}"
when: item.root_password

# the following task loops over each organization and checks whether
# <playbook-dir>/organizations/<organization-name>/ exists
# and stores the result of this check in a variable
Expand Down
6 changes: 6 additions & 0 deletions templates/generator/shadow.jinja2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
root:{{ item.root_password }}:17137:0:99999:7:::
daemon:*:0:0:99999:7:::
ftp:*:0:0:99999:7:::
network:*:0:0:99999:7:::
nobody:*:0:0:99999:7:::
dnsmasq:x:0:0:99999:7:::

0 comments on commit 799e982

Please sign in to comment.