Wednesday 6 May 2020

How to install Apache using Ansible

How to install Apache using Ansible

Use the powerful ansible tool to install Apache on your local machine or you can install on any remote server as well.

1. Install Ansible Modules

[root@dev02 ~]# yum install ansible*
Oracle Linux 8 EPEL Packages for Development (x86_64)                                                                                                             1.5 kB/s | 2.5 kB     00:01
Oracle Linux 8 Gluster Appstream (x86_64)                                                                                                                         1.9 kB/s | 2.7 kB     00:01
Oracle Linux 8 Application Stream (x86_64)                                                                                                                        2.1 kB/s | 2.9 kB     00:01
Oracle Linux 8 Application Stream (x86_64)                                                                                                                        1.2 MB/s |  20 MB     00:16
Oracle Linux 8 BaseOS Latest (x86_64)                                                                                                                             1.9 kB/s | 2.7 kB     00:01
Oracle Linux 8 BaseOS Latest (x86_64)                                                                                                                             1.9 MB/s |  19 MB     00:10
Oracle Linux 8 Development Packages (x86_64)                                                                                                                      0.0  B/s |   0  B     00:18
Latest Unbreakable Enterprise Kernel Release 6 for Oracle Linux 8 (x86_64)                                                                                        0.0  B/s |   0  B     00:12
Failed to synchronize cache for repo 'ol8_developer', ignoring this repo.
Failed to synchronize cache for repo 'ol8_UEKR6', ignoring this repo.
Dependencies resolved.
==================================================================================================================================================================================================
 Package                                           Arch                                  Version                                          Repository                                         Size
==================================================================================================================================================================================================
Installing:
 ansible-doc                                       noarch                                2.9.5-1.el8                                      ol8_developer_EPEL                                 12 M
 ansible                                           noarch                                2.9.5-1.el8                                      ol8_developer_EPEL                                 17 M
 ansible-freeipa                                   noarch                                0.1.8-3.el8                                      ol8_appstream                                     182 k
Installing dependencies:
 sshpass                                           x86_64                                1.06-9.el8                                       ol8_developer_EPEL                                 28 k
 python3-babel                                     noarch                                2.5.1-5.el8                                      ol8_appstream                                     4.8 M
 python3-jinja2                                    noarch                                2.10.1-2.el8_0                                   ol8_appstream                                     538 k
 python3-jmespath                                  noarch                                0.9.0-11.el8                                     ol8_appstream                                      45 k
 python3-markupsafe                                x86_64                                0.23-19.el8                                      ol8_appstream                                      39 k

Transaction Summary
==================================================================================================================================================================================================
Install  8 Packages

Total download size: 34 M
Installed size: 455 M
Is this ok [y/N]: y
Downloading Packages:
(1/8): sshpass-1.06-9.el8.x86_64.rpm                                                                                                                              4.7 kB/s |  28 kB     00:06
(2/8): python3-babel-2.5.1-5.el8.noarch.rpm                                                                                                                       203 kB/s | 4.8 MB     00:24
(3/8): python3-jinja2-2.10.1-2.el8_0.noarch.rpm                                                                                                                    70 kB/s | 538 kB     00:07
(4/8): ansible-freeipa-0.1.8-3.el8.noarch.rpm                                                                                                                      24 kB/s | 182 kB     00:07
(5/8): python3-jmespath-0.9.0-11.el8.noarch.rpm                                                                                                                    14 kB/s |  45 kB     00:03
(6/8): python3-markupsafe-0.23-19.el8.x86_64.rpm                                                                                                                   75 kB/s |  39 kB     00:00
(7/8): ansible-doc-2.9.5-1.el8.noarch.rpm                                                                                                                         147 kB/s |  12 MB     01:20
(8/8): ansible-2.9.5-1.el8.noarch.rpm                                                                                                                             165 kB/s |  17 MB     01:47
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                             329 kB/s |  34 MB     01:47
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                          1/1
  Installing       : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                     1/8
  Installing       : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                    2/8
  Installing       : python3-babel-2.5.1-5.el8.noarch                                                                                                                                         3/8
  Installing       : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                     4/8
  Installing       : sshpass-1.06-9.el8.x86_64                                                                                                                                                5/8
  Installing       : ansible-2.9.5-1.el8.noarch                                                                                                                                               6/8
  Installing       : ansible-freeipa-0.1.8-3.el8.noarch                                                                                                                                       7/8
  Installing       : ansible-doc-2.9.5-1.el8.noarch                                                                                                                                           8/8
  Running scriptlet: ansible-doc-2.9.5-1.el8.noarch                                                                                                                                           8/8
  Verifying        : ansible-doc-2.9.5-1.el8.noarch                                                                                                                                           1/8
  Verifying        : sshpass-1.06-9.el8.x86_64                                                                                                                                                2/8
  Verifying        : ansible-2.9.5-1.el8.noarch                                                                                                                                               3/8
  Verifying        : python3-babel-2.5.1-5.el8.noarch                                                                                                                                         4/8
  Verifying        : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                     5/8
  Verifying        : ansible-freeipa-0.1.8-3.el8.noarch                                                                                                                                       6/8
  Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                     7/8
  Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                    8/8

Installed:
  ansible-doc-2.9.5-1.el8.noarch           ansible-2.9.5-1.el8.noarch               ansible-freeipa-0.1.8-3.el8.noarch        sshpass-1.06-9.el8.x86_64     python3-babel-2.5.1-5.el8.noarch
  python3-jinja2-2.10.1-2.el8_0.noarch     python3-jmespath-0.9.0-11.el8.noarch     python3-markupsafe-0.23-19.el8.x86_64

Complete!
[root@dev02 ~]# which ansible
/usr/bin/ansible


2. Install Apache web Server using Ansible

[root@dev02 ansible]# ansible localhost -m yum -a "name=httpd state=latest"
localhost | CHANGED => {
    "ansible_facts": {
        "pkg_mgr": "dnf"
    },
    "changed": true,
    "msg": "",
    "rc": 0,
    "results": [
        "Installed: apr-util-1.6.1-6.el8.x86_64",
        "Installed: httpd-filesystem-2.4.37-21.0.1.module+el8.2.0+5576+c083ffcb.noarch",
        "Installed: apr-1.6.3-9.el8.x86_64",
        "Installed: httpd-2.4.37-21.0.1.module+el8.2.0+5576+c083ffcb.x86_64",
        "Installed: httpd-tools-2.4.37-21.0.1.module+el8.2.0+5576+c083ffcb.x86_64",
        "Installed: mod_http2-1.11.3-3.module+el8.2.0+5576+c083ffcb.x86_64"
    ]
}
[root@dev02 ansible]#


[root@dev02 ansible]#  which httpd
/usr/sbin/httpd

3. Just try to ping any server using ansible

[root@dev02 ansible]# ansible localhost -m ping
localhost | SUCCESS => {
    "changed": false,
    "ping": "pong"
}
[root@dev02 ansible]#


Tuesday 5 May 2020

How to Setup OCI CLI on Linux

How to Setup OCI CLI on Linux

This blog shows how to setup OCI CLI on Linux

[root@dev02 ~]# oci setup config
    This command provides a walkthrough of creating a valid CLI config file.

    The following links explain where to find the information required by this
    script:

    User API Signing Key, OCID and Tenancy OCID:

        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#Other

    Region:

        https://docs.cloud.oracle.com/Content/General/Concepts/regions.htm

    General config documentation:

        https://docs.cloud.oracle.com/Content/API/Concepts/sdkconfig.htm


Enter a location for your config [/root/.oci/config]:
Enter a user OCID: ocid1.user.oc1..adfdaaaaq54tehkijdffd2gpshbfgfsfgfgfgfp98dfdfdfdfjwrolhmq7bq
Enter a tenancy OCID: ocid1.tenancy.oc1..aaaaaaaaefb4u5ccdfdfsdfd87d89000901adfdfb2cgqfte2dosmdd5o2q
Enter a region (e.g. ap-melbourne-1, ap-mumbai-1, ap-osaka-1, ap-seoul-1, ap-sydney-1, ap-tokyo-1, ca-montreal-1, ca-toronto-1, eu-amsterdam-1, eu-frankfurt-1, eu-zurich-1, me-jeddah-1, sa-saopaulo-1, uk-gov-london-1, uk-london-1, us-ashburn-1, us-gov-ashburn-1, us-gov-chicago-1, us-gov-phoenix-1, us-langley-1, us-luke-1, us-phoenix-1): ap-mumbai-1
Do you want to generate a new API Signing RSA key pair? (If you decline you will be asked to supply the path to an existing key.) [Y/n]: Y
Enter a directory for your keys to be created [/root/.oci]:
Enter a name for your key [oci_api_key]:
Public key written to: /root/.oci/oci_api_key_public.pem
Enter a passphrase for your private key (empty for no passphrase):
Private key written to: /root/.oci/oci_api_key.pem
Fingerprint: 30:9c:4d:34:5b:36:4c:80:61:2a:62:dd:b8:d5:a5:9d
Config written to /root/.oci/config


    If you haven't already uploaded your API Signing public key through the
    console, follow the instructions on the page linked below in the section
    'How to upload the public key':

        https://docs.cloud.oracle.com/Content/API/Concepts/apisigningkey.htm#How2


[root@dev02 ~]#

XX_XXXXXXX is not a valid responsibility for the current user. Please contact your System Administrator.

  XX_XXXXXXX is not a valid responsibility for the current user. Please contact your System Administrator. Issue : When user logs into EBS, ...