ansible redhat cluster 2 node with firewalld with high availability module enabled

[root@localhost ~]# cat clustersuite.yml
- hosts: all
  user: root
  become: yes
  become_method: sudo
  tasks:
  - name: high availability is removed/installed
    yum: name='@High Availability' state=present
  - name: resilent storage is removed/installed
    yum: name='@Resilient Storage' state=present

  - name: install pcs pacemaker fence-agent-all
    command: yum install pcs pacemaker fence-agents-all
  - name: pcsd is running and enabled
    service:
     name=pcsd
     state=started
     enabled=yes

  - firewalld:
      service: high-availability
      permanent: yes
      state: enabled

[root@localhost ~]#



[root@localhost ~]# ansible-playbook clustersuite.yml

PLAY [all] *************************************************************************************************************************************************************

TASK [Gathering Facts] *************************************************************************************************************************************************
ok: [192.168.0.107]
ok: [192.168.0.105]

TASK [high availability is removed/installed] **************************************************************************************************************************
changed: [192.168.0.105]
changed: [192.168.0.107]

TASK [resilent storage is removed/installed] ***************************************************************************************************************************
changed: [192.168.0.107]
changed: [192.168.0.105]

TASK [install pcs pacemaker fence-agent-all] ***************************************************************************************************************************
 [WARNING]: Consider using yum module rather than running yum

changed: [192.168.0.107]
changed: [192.168.0.105]

TASK [pcsd is running and enabled] *************************************************************************************************************************************
changed: [192.168.0.105]
changed: [192.168.0.107]

TASK [firewalld] *******************************************************************************************************************************************************
changed: [192.168.0.105]
changed: [192.168.0.107]
PLAY RECAP *************************************************************************************************************************************************************
192.168.0.105              : ok=1    changed=5   unreachable=0    failed=0
192.168.0.107              : ok=1    changed=5    unreachable=0    failed=0

[root@localhost ~]# pcs cluster auth controller compute
controller: Already authorized
compute: Already authorized
[root@localhost ~]#

[root@compute ~]# pcs cluster auth controller compute
controller: Already authorized
compute: Already authorized
[root@compute ~]#

remove node from cluster


[root@localhost ~]# pcs cluster node remove 192.168.0.107 --force
192.168.0.107: Stopping Cluster (pacemaker)...
192.168.0.107: Successfully destroyed cluster
Error: Unable to update any nodes
[root@localhost ~]#


root@compute ~]# pcs cluster node remove 192.168.0.105
192.168.0.105: Stopping Cluster (pacemaker)...
192.168.0.105: Successfully destroyed cluster
192.168.0.107: Corosync updated

create a cluster

[root@localhost ~]# pcs cluster setup --start --name cluster controller compute
Destroying cluster on nodes: controller, compute...
compute: Stopping Cluster (pacemaker)...
controller: Stopping Cluster (pacemaker)...
compute: Successfully destroyed cluster
controller: Successfully destroyed cluster

Sending 'pacemaker_remote authkey' to 'compute', 'controller'
compute: successful distribution of the file 'pacemaker_remote authkey'
controller: successful distribution of the file 'pacemaker_remote authkey'
Sending cluster config files to the nodes...
controller: Succeeded
compute: Succeeded

Starting cluster on nodes: controller, compute...
controller: Starting Cluster (corosync)...
compute: Starting Cluster (corosync)...
controller: Starting Cluster (pacemaker)...
compute: Starting Cluster (pacemaker)...

Synchronizing pcsd certificates on nodes controller, compute...
controller: Success
compute: Success
Restarting pcsd on the nodes in order to reload the certificates...
controller: Success
compute: Success
[root@localhost ~]# 
[root@localhost ~]# pcs cluster enable --all
controller: Cluster Enabled
compute: Cluster Enabled
[root@localhost ~]# 

[root@localhost ~]# pcs cluster status
Cluster Status:
 Stack: corosync
 Current DC: controller (version 1.1.20-5.el7_7.1-3c4c782f70) - partition with quorum
 Last updated: Wed Oct  9 16:53:43 2019
 Last change: Wed Oct  9 16:50:28 2019 by hacluster via crmd on controller
 2 nodes configured
 0 resources configured

PCSD Status:
  controller: Online
  compute: Online
[root@localhost ~]# 


[root@compute ~]# pcs cluster status
Cluster Status:
 Stack: corosync
 Current DC: controller (version 1.1.20-5.el7_7.1-3c4c782f70) - partition with quorum
 Last updated: Wed Oct  9 16:53:11 2019
 Last change: Wed Oct  9 16:50:28 2019 by hacluster via crmd on controller
 2 nodes configured
 0 resources configured

PCSD Status:
  compute: Online
  controller: Online
[root@compute ~]# 

after reboot :

[root@controller ~]# pcs cluster status
Cluster Status:
 Stack: corosync
 Current DC: controller (version 1.1.20-5.el7_7.1-3c4c782f70) - partition with quorum
 Last updated: Wed Oct  9 17:12:12 2019
 Last change: Wed Oct  9 16:50:28 2019 by hacluster via crmd on controller
 2 nodes configured
 0 resources configured

PCSD Status:
  controller: Offline
  compute: Online
[root@controller ~]#  pcs cluster enable --all
compute: Cluster Enabled
Error: unable to enable all nodes
Unable to connect to controller, try setting higher timeout in --request-timeout option (Failed connect to controller:2224; Connection refused)
[root@controller ~]# pcs cluster auth controller compute
Username: hacluster
Password:
Error: Unable to communicate with controller
compute: Authorized
Error: Unable to synchronize and save tokens on nodes: controller. Are they authorized?
[root@controller ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.107  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::20c:29ff:fe85:e029  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:85:e0:29  txqueuelen 1000  (Ethernet)
        RX packets 5557  bytes 772260 (754.1 KiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 4109  bytes 547055 (534.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

genev_sys_6081: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 65000
        inet6 fe80::6c35:dfff:fe32:bc56  prefixlen 64  scopeid 0x20<link>
        ether 6e:35:df:32:bc:56  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 8  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 41471  bytes 3720086 (3.5 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 41471  bytes 3720086 (3.5 MiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@controller ~]# firewall-cmd --list-all
public
  target: default
  icmp-block-inversion: no
  interfaces:
  sources:
  services: ssh dhcpv6-client high-availability
  ports:
  protocols:
  masquerade: no
  forward-ports:
  source-ports:
  icmp-blocks:
  rich rules:

[root@controller ~]# service pcsd status
Redirecting to /bin/systemctl status pcsd.service
● pcsd.service - PCS GUI and remote configuration interface
   Loaded: loaded (/usr/lib/systemd/system/pcsd.service; enabled; vendor preset: disabled)
   Active: failed (Result: timeout) since Wed 2019-10-09 17:07:52 IST; 40min ago
     Docs: man:pcsd(8)
           man:pcs(8)
  Process: 1707 ExecStart=/usr/lib/pcsd/pcsd (code=exited, status=0/SUCCESS)
 Main PID: 1707 (code=exited, status=0/SUCCESS)

Oct 09 17:06:22 controller systemd[1]: Starting PCS GUI and remote configur.....
Oct 09 17:07:51 controller systemd[1]: pcsd.service start operation timed o...g.
Oct 09 17:07:52 controller systemd[1]: Failed to start PCS GUI and remote c...e.
Oct 09 17:07:52 controller systemd[1]: Unit pcsd.service entered failed state.
Oct 09 17:07:52 controller systemd[1]: pcsd.service failed.
Hint: Some lines were ellipsized, use -l to show in full.
[root@controller ~]# service pcsd start
Redirecting to /bin/systemctl start pcsd.service
[root@controller ~]# service pcsd status
Redirecting to /bin/systemctl status pcsd.service
● pcsd.service - PCS GUI and remote configuration interface
   Loaded: loaded (/usr/lib/systemd/system/pcsd.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-10-09 17:48:50 IST; 2s ago
     Docs: man:pcsd(8)
           man:pcs(8)
 Main PID: 4993 (pcsd)
    Tasks: 7
   CGroup: /system.slice/pcsd.service
           └─4993 /usr/bin/ruby /usr/lib/pcsd/pcsd

Oct 09 17:48:48 controller systemd[1]: Starting PCS GUI and remote configur.....
Oct 09 17:48:50 controller systemd[1]: Started PCS GUI and remote configura...e.
Hint: Some lines were ellipsized, use -l to show in full.
[root@controller ~]# pcs cluster auth controller compute
controller: Already authorized
compute: Already authorized
[root@controller ~]# pcs cluster status
Cluster Status:
 Stack: corosync
 Current DC: controller (version 1.1.20-5.el7_7.1-3c4c782f70) - partition with quorum
 Last updated: Wed Oct  9 17:49:36 2019
 Last change: Wed Oct  9 16:50:28 2019 by hacluster via crmd on controller
 2 nodes configured
 0 resources configured

PCSD Status:
  controller: Online
  compute: Online

[root@compute ~]# pcs config
Cluster Name: cluster
Corosync Nodes:
 controller compute
Pacemaker Nodes:
 compute controller

Resources:

Stonith Devices:
Fencing Levels:

Location Constraints:
Ordering Constraints:
Colocation Constraints:
Ticket Constraints:

Alerts:
 No alerts defined

Resources Defaults:
 No defaults set
Operations Defaults:
 No defaults set

Cluster Properties:
 cluster-infrastructure: corosync
 cluster-name: cluster
 dc-version: 1.1.20-5.el7_7.1-3c4c782f70
 have-watchdog: false

Quorum:
  Options:
[root@compute ~]# 

[root@compute ~]# pcs status
Cluster name: cluster

WARNINGS:
No stonith devices and stonith-enabled is not false

Stack: corosync
Current DC: controller (version 1.1.20-5.el7_7.1-3c4c782f70) - partition with quorum
Last updated: Wed Oct  9 18:31:48 2019
Last change: Wed Oct  9 16:50:28 2019 by hacluster via crmd on controller

2 nodes configured
0 resources configured

Online: [ compute controller ]

No resources


Daemon Status:
  corosync: active/enabled
  pacemaker: active/enabled
  pcsd: active/enabled
[root@compute ~]# 


Comments