Comments (17)
@makorne In YAML, indention is important. Do you see the issue when you compare:
- comment: 'Enable Debian stretch repository'
uri: '{{ ansible_local.apt.default_sources_map.Debian[0]
to:
Please learn how YAML works. It is a basic building block of Ansible.
from ansible-dropbear_initramfs.
Please, how to get this work?
Look at yum, apt so on... they dont have the loud name "playbook"!
But they dont require to fill out many unknown files in unknown order with unknown variables from other spagetti of unknown files..
Provided example does not work! You are the God of this code, you are the maintainer...
And even you cant create an easy WORKING example for localhost?
Please, a real example - what files with what sources are required to get it work?
Or is that impossible to get it work?
from ansible-dropbear_initramfs.
The example should work you just need to get the indention for YAML correct:
## Load APT pinning presets.
apt_preferences__group_list:
- '{{ apt_preferences__preset_list | list }}'
apt__group_sources:
- comment: 'Enable Debian stretch repository'
uri: '{{ ansible_local.apt.default_sources_map.Debian[0]
if (ansible_local|d() and ansible_local.apt|d() and
ansible_local.apt.default_sources_map|d() and
ansible_local.apt.default_sources_map.Debian|d() and
ansible_local.apt.default_sources_map.Debian[0]|d())
else "http://deb.debian.org/debian" }}'
suites:
- 'stretch'
component:
- 'main'
dropbear_initramfs__base_packages:
- 'dropbear-initramfs'
Again the advice to get some basic knowledge of this stuff. This role is a bit advanced as most DebOps roles. Maybe watch a good introduction talk to Ansible, write a few playbooks and maybe a small role to get familiar with how this is supposed to work. After that you should be able to get up and running with this role.
from ansible-dropbear_initramfs.
nano /root/project-directory/ansible/playbooks/dropbear_initramfs.yml
- name: Setup the dropbear ssh server in initramfs
hosts: [ myhost, 'debops_service_dropbear_initramfs' ]
become: True
environment: '{{ inventory__environment | d({})
| combine(inventory__group_environment | d({}))
| combine(inventory__host_environment | d({})) }}'
roles:
- role: debops.apt_preferences
tags: [ 'role::apt_preferences' ]
apt_preferences__dependent_list:
- '{{ dropbear_initramfs__apt_preferences__dependent_list }}'
- role: debops-contrib.dropbear_initramfs
tags: [ 'role::dropbear_initramfs' ]
## Load APT pinning presets.
apt_preferences__group_list:
- '{{ apt_preferences__preset_list | list }}'
apt__group_sources:
- comment: 'Enable Debian stretch repository'
uri: '{{ ansible_local.apt.default_sources_map.Debian[0]
if (ansible_local|d() and ansible_local.apt|d() and
ansible_local.apt.default_sources_map|d() and
ansible_local.apt.default_sources_map.Debian|d() and
ansible_local.apt.default_sources_map.Debian[0]|d())
else "http://deb.debian.org/debian" }}'
suites:
- 'stretch'
component:
- 'main'
dropbear_initramfs__base_packages:
- 'dropbear-initramfs'
[debops_service_dropbear_initramfs]
myhost
ansible-playbook /root/project-directory/ansible/playbooks/dropbear_initramfs.yml -vvvv
SUDO password[defaults to SSH password]:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/root/project-directory/ansible/playbooks/dropbear_initramfs.yml': line 22, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
## Load APT pinning presets.
apt_preferences__group_list:
^ here
from ansible-dropbear_initramfs.
This should go into the inventory as the docs mention ("you can set the following in your inventory:")
Please, get some basic knowledge how Ansible works first: https://docs.ansible.com/ansible/intro_inventory.html
I think there is a saying in English: "You must learn to crawl before you can walk"
from ansible-dropbear_initramfs.
Ansibleโs inventory file, which defaults to being saved in the location /etc/ansible/hosts
Add to this inventory file... Start
ERROR! Attempted to read "/etc/ansible/hosts" as YAML: Syntax Error while loading YAML.
The error appears to have been in '/etc/ansible/hosts': line 24, column 1, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
## Load APT pinning presets.
apt_preferences__group_list:
^ here
Attempted to read "/etc/ansible/hosts" as ini file: /etc/ansible/hosts:25: Expected key=value host variable assignment, got: {{ apt_preferences__preset_list | list }}
from ansible-dropbear_initramfs.
Your question, and many more which may follow, are answered by Ansible introduction docs. You can also check https://docs.debops.org/en/latest/debops-playbooks/docs/guides/getting-started.html.
But to actually answer your question. Put the variables into group_vars/debops_service_dropbear_initramfs
for example. But before you have further questions. Please take the time to read the getting started docs.
from ansible-dropbear_initramfs.
Or considering that you did not follow the example docs of the role, better place it into group_vars/all/debops_service_dropbear_initramfs.yml
or maybe better host_vars/myhost
.
from ansible-dropbear_initramfs.
Added to /root/project-directory/ansible/inventory/host_vars/myhost
TASK [debops.apt_preferences : Remove legacy APT preferences] ******************
task path: /etc/ansible/roles/debops.apt_preferences/tasks/main.yml:4
fatal: [192.168.56.103]: FAILED! => {
"failed": true,
"msg": "[u'{{ dropbear_initramfs__apt_preferences__dependent_list }}']: 'dropbear_initramfs__apt_preferences__dependent_list' is undefined"
}
to retry, use: --limit @/root/project-directory/ansible/playbooks/dropbear_initramfs.retry
PLAY RECAP *********************************************************************
192.168.56.103 : ok=1 changed=0 unreachable=0 failed=1
from ansible-dropbear_initramfs.
I just tried it using Ansible 2.3 as well. Works for me. dropbear_initramfs__apt_preferences__dependent_list
is defined by this role and should be defined. Try debugging using the Ansible debug
module.
from ansible-dropbear_initramfs.
ok: [192.168.56.103]
META: ran handlers
TASK [debops.apt_preferences : Remove legacy APT preferences] ******************
task path: /etc/ansible/roles/debops.apt_preferences/tasks/main.yml:4
fatal: [192.168.56.103]: FAILED! => {
"failed": true,
"msg": "[u'{{ dropbear_initramfs__apt_preferences__dependent_list }}']: 'dropbear_initramfs__apt_preferences__dependent_list' is undefined"
}
Debugger invoked
(debug)
What to do with debug ?
from ansible-dropbear_initramfs.
You can check with the task:
- debug: var=dropbear_initramfs__apt_preferences__dependent_list
at various stages of the playbook execution if the variable is defined.
from ansible-dropbear_initramfs.
If add to nano /root/project-directory/ansible/playbooks/dropbear_initramfs.yml
ERROR! 'debug' is not a valid attribute for a Play
The error appears to have been in '/root/project-directory/ansible/playbooks/dropbear_initramfs.yml': line 6, column 3, but may be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
become: True
- debug: var=dropbear_initramfs__apt_preferences__dependent_list
^ here
In which file to add this? - debug: var=dropbear_initramfs__apt_preferences__dependent_list
from ansible-dropbear_initramfs.
Can you try to figure this out?
from ansible-dropbear_initramfs.
When I try inserting the debug string in different places in the file
/root/project-directory/ansible/playbooks/dropbear_initramfs.yml
I get the following:
ERROR! Syntax Error while loading YAML.
The error appears to have been in '/root/project-directory/ansible/playbooks/dropbear_initramfs.yml': line 7, column 3, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
| combine(inventory__host_environment | d({})) }}'
- debug: var=dropbear_initramfs__apt_preferences__dependent_list
^ here
So I asked, may be I should insert it into another file?
Maybe it is easier for you to give me all working files?
from ansible-dropbear_initramfs.
Maybe it is easier for you to give me all working files?
You should have all working files. I am not messing around here
There is even independent proof of this: https://travis-ci.org/debops-contrib/ansible-dropbear_initramfs
So I asked, may be I should insert it into another file?
As the name suggests, it would go into a task file or task section which you would know when you would know the basics of Ansible which YOU WILL NEED for any serious use of Ansible
from ansible-dropbear_initramfs.
Closing as invalid.
from ansible-dropbear_initramfs.
Related Issues (2)
- Example playbook wrong? HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-dropbear_initramfs.