How to add a PPA repository using Ansible?

To add a PPA repository using Ansible, use

  - name: add ppa
    apt_repository:
      validate_certs: no
      repo: 'ppa:ondrej/php'
      state: present

Example

---
  - hosts: web
    user: root
    tasks:
        - name: update system
          apt:
            update_cache: yes
            cache_valid_time: 3600
        - name: add ppa
          apt_repository:
            validate_certs: no
            repo: 'ppa:ondrej/php'
            state: present
        - name: inatall php
          apt:
            pkg:
            - php8.1-bcmath
            - php8.1-cli
            - php8.1-common
            - php8.1-curl
            - php8.1-gd
            - php8.1-imap
            - php8.1-intl
            - php8.1-mbstring
            - php8.1-mysql
            - php8.1-readline
            - php8.1-soap
            - php8.1-xml
            - php8.1-xmlrpc
            - php8.1-zip
            - php8.1-imagick
            - composer
            - ImageMagick

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *