Re: is Ansible easy to use?
On 20/10/2022 15:47, Anssi Saari wrote: Philipp Ewald writes: Hi folks, is ansible a easy way to configure customized hosts? First try, its super complicated for me. For me it has been. ssh loops work too though. Sometimes I've felt Ansible whines needlessly, something like "please don't do what you need to do, do it our backward way instead". I think that was about editing a file with sed. Ansible's philosophy is "idempotency". That is, instead of having a script that, for example "Adds a user to /etc/passwd", Ansible defines a configuration to "ensure that the user exists in /etc/passwd". The difference between the two approaches comes when you re-run the script. If you have a script that simply append a line to a config, then you'll quickly end up with duplicated lines. But with the ansible philosophy, if the line is already there, then there are no changes to be made. By buying into the Ansible philosophy, you get the benefit of all the core and community modules where people have already coded all the hard bits of "Find matching lines", "Rewrite the file atomically", "Handle ACLs and SELinux contexts" and all those things you might not already think of. Trying to create multiple files with content. It takes more time to create the playbook then creating this file by hand (this damn syntax acomplicates everything more) Then formatting is destroyed or need more time on creating the playbook... Are you sure you aren't over complicating things? To me that sounds like you need to copy a few files over? Or do you need to create host specific files? But do they have to be created by Ansible? It is so hard or im so bad? I use ansible a little sometimes to propagate config stuff in my little home network like firewall configuration and such. So, copying files and running commands mostly. Sometimes appending lines to config files. I don't really understand why Ansible has two interfaces, the playbook one and the normal command line. But, for my simple needs running stuff on the command line works and I have a bunch of notes on how to do things. Unfortunately pretty much every example online seems to use playbooks. You can't check a command line into code control. You can basically only run one task or one role from the command line. But this is just the same as writing a script versus executing the commands at the bash prompt. OpenPGP_signature Description: OpenPGP digital signature
Re: is Ansible easy to use?
On 10/20/22 15:39, Philipp Ewald wrote: Hi folks, is ansible a easy way to configure customized hosts? Ansible is not easy to master but worth the time if you have lots of nodes! If you need to copy a file to multiple servers and have a custom config per node the 'template' module is your friend. First try, its super complicated for me. Trying to create multiple files with content. It takes more time to create the playbook then creating this file by hand (this damn syntax To validate that syntax I use 'ansible-lint ' 'ansible-playbook --syntax-check '. acomplicates everything more) Then formatting is destroyed or need more time on creating the playbook... See the indent capability of the template module. It is so hard or im so bad? When you start at something, everything is hard (the Ansible mailing list is friendly)! The main reason to use Ansible, Puppet, Terraform is when your current solution becomes unmanagable! Granted, the above three tools are not realy doing the same thing! -- John Doe
Re: is Ansible easy to use?
On Thu, 20 Oct 2022 15:39:23 +0200 Philipp Ewald wrote: > Hi folks, > > is ansible a easy way to configure customized hosts? > First try, its super complicated for me. > > Trying to create multiple files with content. It takes more time to > create the playbook then creating this file by hand (this damn syntax > acomplicates everything more) Then formatting is destroyed or need > more time on creating the playbook... > > It is so hard or im so bad? You might be bad (joke), but so is ansible. Actually, ansible is a great tool. It's flexible and can do almost anything. But the learning curve is steep. It's finicky about syntax, as you noted. I investigated a few of these packages, particularly ansible, a while back. When you look at how they work, they mostly operate the same way underneath all the syntax. I got tired of trying to work all this out and wrote my own configuration manager in bash, since I'm mostly familiar with bash syntax. You can try other alternatives like cfengine, but I suspect ansible is the most capable. Worst case, you can write a series of scripts using bash and rsync and ssh, and accomplish what you want without having to learn a whole new toolkit. Of course, if your job is a system administrator and you do this all the time with a lot of machines, I'd advise fully studying ansible and using it instead. Paul -- Paul M. Foster Personal Blog: http://noferblatz.com Company Site: http://quillandmouse.com Software Projects: https://gitlab.com/paulmfoster
Re: is Ansible easy to use?
I know it's not the intended use case but I primarily utilize Ansible for individual, customized hosts. It absolutely rocks when you have dozens of systems to manage though. For individual hosts I use it as a way of documenting how a system came to be in its state almost for disaster recovery (i.e. what software was installed, config file templates, etc.). If you find yourself setting up certain stuff routinely, make it a "role" and reuse it like a function. I do cheat on those custom boxes though by running through the ansible playbook that takes me 90% of the way there, then a README to explain the little stuff I had to do by hand because it's still easier to adjust something by hand sometimes. Like any complex framework, it takes a bit of patience to learn and learn some more before getting to the payoff point. At least that's how it is for we mortals.
Re: is Ansible easy to use?
Hi Philipp, I don't have a very long and intense experience with Ansible. It doesn't seem complex to me, you have to use the same logic as if you were doing it manually. The biggest problem I have encountered is modifying a configuration file whose different cases are complex. Even with another method, it would be. From: Philipp Ewald Sent: Thursday, October 20, 2022 3:39:23 PM To: debian-user@lists.debian.org Subject: is Ansible easy to use? Hi folks, is ansible a easy way to configure customized hosts? First try, its super complicated for me. Trying to create multiple files with content. It takes more time to create the playbook then creating this file by hand (this damn syntax acomplicates everything more) Then formatting is destroyed or need more time on creating the playbook... It is so hard or im so bad? -- Philipp Ewald Administrator
Re: is Ansible easy to use?
Philipp Ewald wrote: > Hi folks, > > is ansible a easy way to configure customized hosts? > First try, its super complicated for me. > > Trying to create multiple files with content. It takes more time to create > the playbook then creating this file by hand (this damn syntax acomplicates > everything more) > Then formatting is destroyed or need more time on creating the playbook... > > It is so hard or im so bad? The assumption for all system automation systems, including ansible, is that you need to repeat the configuration across many machines, or across a few machines exactly repeatably. On the other hand, they all have different syntax. If you need a system automator and you don't like ansible, try puppet or salt or bcfg or cfengine or... -dsr-
Re: is Ansible easy to use?
Philipp Ewald writes: > Hi folks, > > is ansible a easy way to configure customized hosts? > First try, its super complicated for me. For me it has been. ssh loops work too though. Sometimes I've felt Ansible whines needlessly, something like "please don't do what you need to do, do it our backward way instead". I think that was about editing a file with sed. > Trying to create multiple files with content. It takes more time to > create the playbook then creating this file by hand (this damn syntax > acomplicates everything more) > Then formatting is destroyed or need more time on creating the playbook... Are you sure you aren't over complicating things? To me that sounds like you need to copy a few files over? Or do you need to create host specific files? But do they have to be created by Ansible? > It is so hard or im so bad? I use ansible a little sometimes to propagate config stuff in my little home network like firewall configuration and such. So, copying files and running commands mostly. Sometimes appending lines to config files. I don't really understand why Ansible has two interfaces, the playbook one and the normal command line. But, for my simple needs running stuff on the command line works and I have a bunch of notes on how to do things. Unfortunately pretty much every example online seems to use playbooks.