mikolak-net / ansible-raspi-config Goto Github PK
View Code? Open in Web Editor NEWAnsible role for configuring a headless Raspberry Pi server.
Ansible role for configuring a headless Raspberry Pi server.
The responsibility of setting the locale is put on the Stouts.timezone
role:
https://github.com/mikolak-net/ansible-raspi-config/blob/master/meta/main.yml#L20
However, this role does not set the locale.
This playbok fail on raspberry 3
- hosts: pi
become: true
roles:
- role: mikolak.raspi-config
raspi_config_memory_split_gpu: 16
raspi_config_update_packages: yes
raspi_config_expanded_filesystem: yes
raspi_config_ensure_optimal_cpu_params: yes
raspi_config_enable_camera:
TASK [mikolak.raspi-config : ensure mem split] **********************************************************************************************************************
fatal: [pi3]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Shared connection to 192.168.2.176 closed.\r\n", "module_stdout": "Traceback (most recent call last):\r\n File "/tmp/ansible_qn6m9xwt/ansible_module_pi_boot_config.py", line 88, in \r\n main()\r\n File "/tmp/ansible_qn6m9xwt/ansible_module_pi_boot_config.py", line 72, in main\r\n config_vals = dict((str(key), str(val)) for (key, val) in config_vals.iteritems())\r\nAttributeError: 'dict' object has no attribute 'iteritems'\r\n", "msg": "MODULE FAILURE", "rc": 0}
It seem we have another regression, at least on RPi 2B+. On a fresh install, the timeout seems to hang and fail, despite the machine restarting.
Hi,
I am new to Ansible sorry I don't understand very well everything
I am using this role to test it against a Pi 3B+
When using it along `raspi_config_replace_user' it says
TASK [mikolak-net.raspi_config : optional warning]
******************************************************************************************************
fatal: [10.0.0.2]: FAILED! => {
"msg": "ABLE TO SSH IN WITH FACTORY CREDENTIALS - ASSUME PWNED IF SSH OPEN TO THE INTERNET"
}
I think it says that because it stills has available user "pi" with password "raspberry". Then in another task, I could delete the user, but my question is, why this role doesn't change it? I just want to log in to the Pi through the default credentials and then blocking them, only allowing to connect through ssh to this user and only with the public key of the ansible server.
I know it advises that post_tasks will not continue if it has the default credentials, but why?
Thank you!
`- downloading role 'raspi-config', owned by mikolak
Creating a new user to replace the default one should be idempotent (i.e. should not use changed_when: True
):
ansible-raspi-config/tasks/setup_replace_user.yml
Lines 3 to 8 in 85cae51
I think the step to remove the default user can just be a normal task, not a handler.
It's not supposed to fail if said var is defined, since the user will be then replaced. Suspect this is due to a change of semantics in one of the past Ansible versions.
The problem is with the role that is being used to set the timezone. It first creates a symlink:
https://github.com/Stouts/Stouts.timezone/blob/develop/tasks/timezone.yml#L19-L29, which is then replaced when the update handler is called https://github.com/Stouts/Stouts.timezone/blob/develop/handlers/main.yml#L3-L4 (or at least this is what happens on the OS I'm using). This happens each time the role is ran.
One solution would be to fix the Stouts.timezone
role. However, I suggest instead moving to use the core timezone module that was added in Ansible 2.2:
https://docs.ansible.com/ansible/timezone_module.html
There are a number of issues with the reboot hander and the the associated task that waits for the host to reboot:
reboot
handler fails due to the connection being lost. I suspect the reason for this is because the host reboots before Ansible has exited the task cleanly.wait for reboot
just acts like a timer because no port/path is set: https://github.com/ansible/ansible-modules-core/blob/devel/utilities/logic/wait_for.py#L437-L438.wait for start
timeout is not long enough for my setup (can take over 1 minute with my Pi Zero).Output
TASK [knopki.locale : set locale to {{ locale }}] ******************************
task path: /usr/local/etc/ansible/roles/knopki.locale/tasks/main.yml:7
fatal: [192.168.1.24]: FAILED! => {"failed": true, "msg": "'locale' is undefined"}
Pointing dependency to master, still no tag or simply adding a locale
var to mikolak.raspi-config, this is simply used in a label in https://github.com/knopki/ansible-locale/blob/v1.0.3/tasks/main.yml#L7, it's not used anywhere else.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.