Basic Ansible Introductory Learning Notes

I have been learning from this book Fabio Alessandro Locati, published under Packt>

I thought I just capture a few learning notes as I read.

Introduction to Playbooks

Playgroups are one of the core features of Ansible and tell what Ansible what to execute. They are like a do-list for Ansible that contains a list of tasks; each task internally links to a piece of code called a module

- hosts: all 
  remote_user: vagrant
  tasks: 
    - name: Ensure the HTTPd package is installed 
      yum: 
        name: httpd 
        state: present 
      become: True 
    - name: Ensure the HTTPd service is enabled and running 
      service: 
        name: httpd 
        state: started 
        enabled: True 
      become: True 

What it means?

  • hosts: List the Host or Host groups. The Host field is required. The –list-hosts-host will let us know which hosts the playbook is using.
  • remote_user: The user Ansible will be using while logging onto the system.
  • There are 2 tasks.
    • The first one is to ensure that the httpd package is present
    • The 2nd one is to enable the httpd service is enabled and running
  • The tasks are quite self-explanatory.
  • become: True. The commands should be executed with sudo access. If the sudo user’s file does not allow the user to run the particular command, the command will fail

Running a Playbook

$ ansible-playbook -i host setup_apache.yml

Ansible Verbosity

You can increase the verbosity by using the parameter -v, -vv or -vvv

Variables in Ansible

---
- hosts: all
  remote_user: vagrant
  tasks: 
    - name: Print OS and version
      debug:
        msg: '{{ ansible_distribution }} {{ ansible_distribution_version }}'

Creating the Ansible User

--- 
- hosts: all 
  user: vagrant 
  tasks: 
    - name: Ensure ansible user exists 
      user: 
        name: ansible 
        state: present 
        comment: Ansible 
      become: True
    - name: Ensure ansible user accepts the SSH key 
      authorized_key: 
        user: ansible 
        key: https://github.com/fale.keys 
        state: present 
      become: True
    - name: Ensure the ansible user is sudoer with no password required 
      lineinfile: 
        dest: /etc/sudoers 
        state: present 
        regexp: '^ansible ALL\=' 
        line: 'ansible ALL=(ALL) NOPASSWD:ALL' 
        validate: 'visudo -cf %s'
      become: True

The lineinfile is an interesting module. It works in a similar way to sed (a stream editor) where you specify the regular expression that will be used to match the line, and then specify the new line that will be used to substitute the matched line.

Advertisement

World’s first hydrogen-powered off-grid data centre announced

‘Data Centre-as-a-Service’ pioneer, ECL, has announced the launch of what it claims is the world’s first modular, sustainable, off-grid data centre that uses green hydrogen as its primary power source. The company further claims to be able to deliver data centres in one megawatt (MW) blocks that can achieve 99.9999 per cent uptime.
…..
…..
While other data center providers have deployed hydrogen fuel cells as backup power supplies, and with some conducting trials of systems forecast for production delivery in three-to-five years, ECL asserts that it is the first provider to deliver a fully-green hydrogen-powered data centre. This leapfrog innovation is enabled by bringing together several disruptive technologies including green hydrogen-based power generation, battery energy storage and highly reliable power architecture without dependence on the utility grid.
…..
…..
ECL also said that its cooling innovations enable much higher density-per-rack than traditional data centre providers, a strong benefit given the increasing per-server power consumption driven by accelerating chip and system density. Water created as a by-product of hydrogen-based power generation is used to cool ECL’s server racks, eliminating the need for external water sources. Combining this with proprietary rear door heat exchange technology results in lower Power Usage Effectiveness (PUE) ratios than any other colocation data centre provider.

World’s first hydrogen-powered off-grid data centre announced

Open Source – Policy Plus for All Windows Edition

This is not an entry for Linux, but for Open Source

If you require an Open-Source Local Group Policy for All Windows Editions including Home, you may want to consider Policy Plus

According to the Project Websie

Policy Plus is intended to make the power of Group Policy settings available to everyone.

  • Run and work on all Windows editions, not just Pro and Enterprise
  • Comply fully with licensing (i.e. transplant no components across Windows installations)
  • View and edit Registry-based policies in local GPOs, per-user GPOs, individual POL files, offline Registry user hives, and the live Registry
  • Navigate to policies by ID, text, or affected Registry entries
  • Show additional technical information about objects (policies, categories, products)
  • Provide convenient ways to share and import policy settings

2023 Look Ahead to Platform Engineering

CloudCast: 2023 Look Ahead to Platform Engineering

The Cloudcast discusses platform engineering with the founder and CEO of RackN, Rob Hirschfeld. Starting around the 10-minute mark, the conversation covers the goals and best practices of platform engineering.

Topic 1 – Welcome back to the show, it was great to see you in person at events recently. What have you been focusing on the last couple of years?

Topic 2 – There’s been a lot of discussion about Platform Engineering over the last 6+ months. You’ve been around this space for a while. We’re trying to understand if PE is different from DevOps or SRE or Cloud Platform in the past, or an evolution. Is PE just a common platform maintained with reusable tools, regardless of the infrastructure? 

Topic 3 – I’ve heard people say that Cloud Platform and Platform Engineering are colleagues. where one owns/operates the platform, and the other is the “product manager” to the application teams. Is this realistic? 

Topic 4 – What does “good” look like for Platform Engineering? Is the goal a frictionless developer experience? Are developer consistency and efficiency valid goals? Are there KPIs or Metrics that “good” teams are striving towards?

Topic 5 –  Any interesting technologies that you’re seeing that make Platform Engineering easier, or more manageable? 

Topic 6 – Any team dynamics that you’re seeing that make Platform Engineering easier, or more manageable?