AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / user-504011

Hiddai's questions

Martin Hope
Hiddai
Asked: 2023-06-25 18:38:11 +0800 CST

添加管理员用户并启用rabbitmq_management的批处理获得单调时间倒退!错误

  • 5

我使用以下批处理文件添加管理员用户并在我的 Windows 服务器中启用rabbitmq 管理站点。

IF "%PROCESSOR_ARCHITECTURE%"=="AMD64" GOTO INST64
pushd C:\Program Files\RabbitMQ Server\rabbitmq_server-3.12.0\sbin
GOTO END
:INST64
pushd C:\Program Files\RabbitMQ Server\rabbitmq_server-3.12.0\sbin
:END
call rabbitmqctl stop_app
call rabbitmqctl reset
call rabbitmqctl start_app
call rabbitmqctl add_user admin admin
call rabbitmqctl set_permissions admin ".*" ".*" ".*"
call rabbitmqctl set_user_tags admin administrator
call rabbitmq-plugins enable rabbitmq_management
 
pause

该批处理在以下 RabbitMQ 版本中对我来说效果很好:3.6.12 3.8.2 3.10.5

现在,迁移到Windows Server 2022并安装Erlang 26.0.1和RabbitMQ 3.12.0,通常在安装 Erlang 和 RabbitMQ 后我不执行任何操作,而是运行批处理文件并以管理员身份登录到rabbitmq 管理站点。但现在?- 每次我运行批处理时都会失败。这是输出:

C:\Program Files\RabbitMQ Server\rabbitmq_server-3.12.0\sbin>call rabbitmqctl stop_app
Monotonic time stepped backwards!
Previous time: 15735273
Current time:  15734249
Monotonic time stepped backwards!
Previous time: 16079719
Current time:  16078695
Monotonic time stepped backwards!
Previous time: 12353401
Current time:  12352377
Monotonic time stepped backwards!
Previous time: 11335990
Current time:  11334966
Monotonic time stepped backwards!
Previous time: 17649224
Current time:  17648200
Monotonic time stepped backwards!
Previous time: 20655484
Current time:  20654460
Monotonic time stepped backwards!
Previous time: 10719626
Current time:  10718602
Press any key to continue . . .

到目前为止我尝试了什么:

  • 我放入advanced.config以下行:[{rabbit, [{time_warp_detection, false}]}].- 重新启动电脑并尝试运行批处理 - 失败
  • 我创建了一个rabbitmq.config并将其放在以下行中:[{rabbit, [{time_warp_detection, false}]}].- 重新启动电脑并尝试运行批处理 - 失败
  • 我执行了该命令rabbitmq-server并得到了以下输出,该输出被卡住并且无法继续。执行此命令允许我进入管理站点,关闭窗口关闭管理站点并获取ERR_CONNECTION_REFUSED:
2023-06-25 13:32:33.764000+03:00 [warning] <0.135.0> Using the old format config file:
 c:/Users/qa/AppData/Roaming/RabbitMQ/rabbitmq.config
2023-06-25 13:32:33.764000+03:00 [warning] <0.135.0> Please update your config files to the new format and 
remove the old file.
2023-06-25 13:32:56.563000+03:00 [notice] <0.44.0> Application syslog exited with reason: stopped
2023-06-25 13:32:56.563000+03:00 [notice] <0.235.0> Logging: switching to configured handler(s); 
following messages may not be visible in this log output

  ##  ##      RabbitMQ 3.12.0
  ##  ##
  ##########  Copyright (c) 2007-2023 VMware, Inc. or its affiliates.
  ######  ##
  ##########  Licensed under the MPL 2.0. Website: https://rabbitmq.com

  Erlang:      26.0.1 [jit]
  TLS Library: OpenSSL - OpenSSL 3.1.0 14 Mar 2023
  Release series support status: supported

  Doc guides:  https://rabbitmq.com/documentation.html
  Support:     https://rabbitmq.com/contact.html
  Tutorials:   https://rabbitmq.com/getstarted.html
  Monitoring:  https://rabbitmq.com/monitoring.html

  Logs: <stdout>
        c:/Users/qa/AppData/Roaming/RabbitMQ/log/[email protected]

  Config file(s): c:/Users/qa/AppData/Roaming/RabbitMQ/rabbitmq.config

  Starting broker... completed with 3 plugins.

请告知,在 Windows Server 2022 上安装 RabbitMQ 3.12.0 后,设置 RabbitMQ 3.12.0 的正确步骤是什么,以便管理站点始终可用并成功创建管理员用户?

更新:此问题也与Erlang 25.XX相关

rabbitmq
  • 1 个回答
  • 19 Views
Martin Hope
Hiddai
Asked: 2022-01-27 00:54:58 +0800 CST

为什么第二次运行 ansible.windows.win_package 不起作用?

  • 1

我有一个产品,我可以先安装它,然后更新它——这意味着为我的基础产品添加更多功能

我是第一次执行 MSI,然后进入添加\删除程序,选择产品时,您可以单击“更改”,安装向导将再次出现,允许您选择并安装产品中的附加功能

我为此任务创建了 2 个 ansible 角色和剧本第一个角色使用 ansible.windows.win_package 安装基础产品(参见下面的示例)

- name: Install Server.msi primary_appserver
  ansible.windows.win_package:
    path: C:\product.msi
    log_path: C:\InstallProduct.log
    arguments:
     ADDLOCAL=DB,Agent
    state: present
  become: true
  become_method: runas
  vars:
    ansible_become_user: "{{ ansible_user }}"
    ansible_become_password: "{{ ansible_password }}"
  when: "'primary_appservers' in group_names"

第二个角色再次使用 ansible.windows.win_package 和不同的 ADDLOCAL 参数(附加功能):

- name: Install Engine primary_appserver
  ansible.windows.win_package:
    path: C:\product.msi
    log_path: C:\InstallEngine.log
    arguments:
     ADDLOCAL=Engine
    state: present
  become: true
  become_method: runas
  vars:
    ansible_become_user: "{{ ansible_user }}"
    ansible_become_password: "{{ ansible_password }}"
  when: "'primary_appservers' in group_names"

第一个角色工作正常并执行 msi 文件,第二个角色 - 不是

windows installation automation msi ansible
  • 1 个回答
  • 458 Views
Martin Hope
Hiddai
Asked: 2021-09-03 23:11:33 +0800 CST

docker - 创建两个容器有两个不同的网络 ID,而不是使用默认的桥接网络

  • 1

我的目标是,Jenkins容器将与Ansible容器“对话”,以便为Jenkins管道创建Jenkins文件。

我预计这两个容器将“加入”以桥接网络并获得相同网络 ID 的 2 个 IP 地址,但是创建了另外两个网络,并且每个容器都获得了不同网络 ID 的 IP。

此外,预计这两个容器将可以访问互联网。

因此,在我的 Windows 10 中,我正在运行 Docker Desktop,我有 2 个 docker-compose.yml 文件,
一个用于Jenkins容器:

version: '3.7'
services:
  jenkins:
    image: jenkins/jenkins:lts
    privileged: true
    user: root
    ports:
      - 8080:8080
      - 50000:50000
    container_name: jenkins

另一个,对于Ansible容器:

version: '2'
services:
  ansible:
    container_name: ansible
    hostname: ansible
    image: ansible
    volumes:
      - ~/product/ansible:/ansible
    working_dir: /ansible
    build:
      context: .
      dockerfile: Dockerfile
    dns:
      - 200.20.200.20

我为每个 docker-compose.yml 文件运行了以下命令,所以我有两台独立的机器:

docker-compose up --build

我检查了容器的网络详细信息,发现每个容器都有不同的网络 ID,见下文:

PS > docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' ansible
172.18.0.2
PS > docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' jenkins
172.19.0.2

检查我的 docker 网络部分,发现除了bridge、host和none之外,还创建了 2 个网络:

PS > docker network ls
NETWORK ID     NAME              DRIVER    SCOPE
8cefaed24885   ansible_default   bridge    local
44bedcd1622d   bridge            bridge    local
61e1c7f7051e   host              host      local
b5a7a7a424a4   jenkins_default   bridge    local
4e5d6c77cb5a   none              null      local

当然,检查桥接网络显示容器密钥为空:

{
    "Name": "bridge",
    "Id": "44bedcd1622d820ce4e29a5cd545f244ba2d303102f1956fe76069a63e7c220e",
    "Created": "2021-08-25T13:13:57.6577149Z",
    "Scope": "local",
    "Driver": "bridge",
    "EnableIPv6": false,
    "IPAM": {
        "Driver": "default",
        "Options": null,
        "Config": [
            {
                "Subnet": "172.17.0.0/16",
                "Gateway": "172.17.0.1"
            }
        ]
    },
    "Internal": false,
    "Attachable": false,
    "Ingress": false,
    "ConfigFrom": {
        "Network": ""
    },
    "ConfigOnly": false,
    "Containers": {},
    "Options": {
        "com.docker.network.bridge.default_bridge": "true",
        "com.docker.network.bridge.enable_icc": "true",
        "com.docker.network.bridge.enable_ip_masquerade": "true",
        "com.docker.network.bridge.host_binding_ipv4": "0.0.0.0",
        "com.docker.network.bridge.name": "docker0",
        "com.docker.network.driver.mtu": "1500"
    },
    "Labels": {},
    "CreatedTime": 1629897237657
}

我的问题是: a)为什么在我运行命令
时又创建了两个 docker 网络? b)如何使这些容器与桥接网络一起工作并获得相同网络 ID(桥接网络 ID 172.17.xx)的 IP,以便它们能够相互通信?docker-compose up --build

networking docker docker-compose docker-networking
  • 1 个回答
  • 544 Views
Martin Hope
Hiddai
Asked: 2021-08-13 14:01:45 +0800 CST

如何设置要为特定库存组运行的任务?

  • 0

以下任务:

- name: Download Jfrog Artifcats
  ansible.windows.win_shell: |
    $ENV:JFROG_CLI_OFFER_CONFIG="false"
    jfrog rt download ...
  when: ???

应该只对位于组center中的机器运行appservers

---
all:
  children:
    root:
      children:
        center:
          children:
            appservers:
              hosts:
                vm1.domain.com:
            qservers:
              hosts:
                vm2.domain.com:
            dbservers:
              hosts:
                vm3.domain.com:
        mobilefarms:
          hosts:
          children:
            gateways:
              hosts:
        south:
          children:
            brooklyn:
              hosts:
                vm4.domain.com:
              children:
                clients:
                  hosts:
                    vm5.domain.com:
                    vm6.domain.com:
        north:
          children:
            new_york:
              hosts:
                vm8.domain.com:
              children:
                clients:
                  hosts:
                    vm9.domain.com:

when为了实现这一点,我应该输入什么作为条件?另外,这个配置选项背后的原理是什么?

configuration ansible
  • 1 个回答
  • 6563 Views
Martin Hope
Hiddai
Asked: 2021-07-31 04:53:01 +0800 CST

如何设置机器状态:使用 community.vmware.vmware_guest_powerstate 任务开机?

  • -1

我对 Ansible 很陌生,所以我可能配置错误
[我有一个在 CentOS8 中运行 Ansible 服务的 Docker 容器
我​​有一个包含 Ansible 文件的 Ansible 存储库(这是一个 .Git 存储库)

我的意愿是自动将 vCenter Server 中的每个实验室(该实验室由 8 个虚拟机、5 个 windows server 2016 和 3 个 windows 10 组成。DC 包括在这些机器中启用 winrm 的策略)到特定快照。但首先我试图:一旦打开实验室机器的电源,一旦关闭实验室的机器电源

所以,我(在ansible-roles-explained-with-examples guide的帮助下):

  • ansible-galaxy init使用命令名称创建了一个角色vcenter(参见下面的目录树)
  • 在文件夹内创建了一些 vCenter 任务文件tasks(请参见下面的目录树)。这是poweroff.yml和poweron.yml任务文件的示例:
- name: Set the state of a virtual machine to poweroff
  community.vmware.vmware_guest_powerstate:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    folder: "/{{ datacenter_name }}/vm/{{ folder }}"
    name: "{{ ansible_hostname }}"
    # name: "{{ guest_name }}"
    validate_certs: no
    state: powered-off
    force: yes
  delegate_to: localhost
  register: deploy
- name: Set the state of a virtual machine to poweron using MoID
  community.vmware.vmware_guest_powerstate:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    folder: "/{{ datacenter_name }}/vm/{{ folder }}"
    name: "{{ ansible_hostname }}"
    # moid: vm-42
    validate_certs: no
    state: powered-on
  delegate_to: localhost
  register: deploy
  • 在文件中提供 vCenter 凭据vcenter\vars\main.yml,如下所示:
# vars file for vcenter
vcenter_hostname: vcenter.foo.com
vcenter_username: [email protected]
vcenter_password: f#0$o#1$0o
datacenter_name: FOO_Fighters
# datastore_name: 
cluster_name: FOO
folder: '/FOO/PRODUCT/DOMAIN.COM/' 
  • 将任务包含在tasks\main.yml带有import-task密钥的文件中,如下所示:
---
# tasks file for roles/vcenter
- import_tasks: poweroff.yml
# - import_tasks: poweron.yml
# - import_tasks: revert.yml
# - import_tasks: shutdown.yml
  • 在库存库中创建了一个all.yml内部 group_vars 文件夹(我不知道它是否是一种专业的方法),其中包括所有 winrm 详细信息,如下所示:
---
#WinRM Protocol Details
ansible_user: DOMAIN\user
ansible_password: f#0$o#1$0o
ansible_connection: winrm
ansible_port: 5985
ansible_winrm_scheme: http
ansible_winrm_server_cert_validation: ignore
ansible_winrm_transport: ntlm
ansible_winrm_read_timeout_sec: 60
ansible_winrm_operation_timeout_sec: 58
  • 创建了一个revert_lab.yml包含角色的剧本,就像这样
---
- name: revert an onpremis lab
  hosts: all
  roles:
  - vcenter

我ansible.cfg的是这样的:

[defaults]
inventory = /ansible/inventories
roles_path = ./roles:..~/ansible/roles

我成功执行了 playbook 以关闭实验室中的所有机器,然后我“打开”了角色中的 poweron 任务,如下所示:

---
# tasks file for roles/vcenter
# - import_tasks: poweroff.yml
- import_tasks: poweron.yml
# - import_tasks: revert.yml
# - import_tasks: shutdown.yml

现在所有实验室的机器都关闭了,执行 playbook,给出以下错误:

PLAY [revert vmware vcenter lab] *************************************************
TASK [Gathering Facts] ***********************************************************
fatal: [vm1.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: 
HTTPConnectionPool(host='vm1.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae4908d0>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}
fatal: [vm2.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: HTTPConnectionPool(host='vm2.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae487b00>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}
fatal: [vm3.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: HTTPConnectionPool(host='vm3.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae48acc0>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}
fatal: [vm4.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: HTTPConnectionPool(host='vm4.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae48de80>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}
fatal: [vm5.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: 
HTTPConnectionPool(host='vm5.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae41f080>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}
fatal: [vm6.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: HTTPConnectionPool(host='vm6.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae41d7f0>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}
fatal: [vm7.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: HTTPConnectionPool(host='vm7.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae428048>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}
fatal: [vm8.domain.com]: UNREACHABLE! => {"changed": false, "msg": "ntlm: HTTPConnectionPool(host='vm8.domain.com', port=5985): Max retries exceeded with url: /wsman (Caused by NewConnectionError('<urllib3.connection.HTTPConnection object at 0x7fb7ae425588>: Failed to establish a new connection: [Errno 111] Connection refused',))", "unreachable": true}

PLAY RECAP ***********************************************************************
vm1.domain.com    : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
vm2.domain.com    : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
vm3.domain.com    : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
vm4.domain.com    : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
vm5.domain.com   : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
vm6.domain.com   : ok=0    changed=0    unreachable=1    failed=0    skipped=0    rescued=0    ignored=0
vm7.domain.com     : ok=0    changed=0    unreachable=1    failed=0    skipped=0   rescued=0    ignored=0
vm8.domain.com     : ok=0    changed=0    unreachable=1    failed=0    skipped=0   rescued=0    ignored=0

为什么 poweroff 任务可以正常工作而 poweron 不能?我该如何解决这个问题?

我的存储库:

C:.
├───ansible
│   │   ansible.cfg
│   ├───inventories
│   │   └───test
│   │       ├───cloud
│   │       └───onpremis
│   │           └───domain.com
│   │               │   lab_j.yml
│   │               │   lab_r.yml
│   │               └───group_vars
│   │                       all.yml
│   ├───playbooks
│   │       revert_lab.yml
│   └───roles
│       └───vcenter
│           ├───tasks
│           │       main.yml
│           │       poweroff.yml
│           │       poweron.yml
│           │       revert.yml
│           │       shutdown.yml
│           └───vars
│                   main.yml

我的库存 lab_r.yml- 这是部分架构

---
all:
  children:
    root:
      children:
        center:
          children:
            appservers:
              hosts:
                vm1.domain.com:
            qservers:
              hosts:
                vm2.domain.com:
            dbservers:
              hosts:
                vm3.domain.com:
virtualization configuration ansible
  • 1 个回答
  • 341 Views
Martin Hope
Hiddai
Asked: 2021-07-22 12:53:38 +0800 CST

为什么ansible无法识别vcenter windows机器?

  • 1

我对 Ansible 很陌生,所以我可能配置错误
[我有一个运行 Ansible 服务的 Docker 容器
我​​有一个包含 Ansible 文件的 Ansible 存储库(这是一个 .Git 存储库)

我的意愿是自动将 vCenter 服务器中的每个实验室恢复为特定快照
所以,我(在ansible-roles-explained-with-examples 指南的帮助下):

  • ansible-galaxy init使用命令名称创建了一个角色vcenter(参见下面的目录树)
  • 在文件夹内创建了一些 vCenter 任务文件tasks(请参见下面的目录树)。以下是poweroff.yml任务文件的示例:
- name: Set the state of a virtual machine to poweroff
  community.vmware.vmware_guest_powerstate:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    folder: "/{{ datacenter_name }}/{{ folder }}"
    # name: "{{ guest_name }}"
    name: "{{ ansible_hostname }}"
    validate_certs: no
    state: powered-off
  delegate_to: localhost
  register: deploy
  • 在文件中提供 vCenter 凭据vcenter\vars\main.yml,如下所示:
# vars file for vcenter
vcenter_hostname: vcenter.foo.com
vcenter_username: [email protected]
vcenter_password: f#0$o#1$0o
datacenter_name: FOO_Fighters
# datastore_name: 
cluster_name: FOO
folder: '/FOO/PRODUCT/DOMAIN.COM/' 
  • 将任务包含在tasks\main.yml带有import-task密钥的文件中,如下所示:
---
# tasks file for roles/vcenter
- import_tasks: poweroff.yml
# - import_tasks: poweron.yml
# - import_tasks: revert.yml
# - import_tasks: shutdown.yml
  • 在库存库中创建了一个all.yml内部 group_vars 文件夹(我不知道它是否是一种专业的方法),其中包括所有 winrm 详细信息,如下所示:
---
#WinRM Protocol Details
ansible_user: DOMAIN\user
ansible_password: f#0$o#1$0o
ansible_connection: winrm
ansible_port: 5985
ansible_winrm_scheme: http
ansible_winrm_server_cert_validation: ignore
ansible_winrm_transport: ntlm
ansible_winrm_read_timeout_sec: 60
ansible_winrm_operation_timeout_sec: 58
  • 创建了一个revert_lab.yml包含角色的剧本,就像这样
---
- name: revert an onpremis lab
  hosts: all
  roles:
  - vcenter

我ansible.cfg的是这样的:

[defaults]
inventory = /ansible/inventories
roles_path = ./roles:..~/ansible/roles

我执行了剧本来恢复实验室中的所有机器:

ansible-playbook playbooks/revert_vcenter_lab.yml -i inventories/test/onpremis/domain.com/lab_r.yml

我得到的错误是:

TASK [Gathering Facts] ****************************************************************************************************************************************************
[WARNING]: Error when collecting winrm facts: You cannot call a method on a null-valued expression.  At line:15 char:17  + ...
$ansibleFacts.ansible_win_rm_certificate_expires = $_.Not ...  +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~      + CategoryInfo          :  
InvalidOperation: (:) [], RuntimeException      + FullyQualifiedErrorId : InvokeMethodOnNull      at <ScriptBlock>, <No file>: line 15  at <ScriptBlock>, <No file>: line  
13
ok: [vm1.domain.com]
ok: [vm2.domain.com]
ok: [vm3.domain.com]
ok: [vm4.domain.com]
ok: [vm5.domain.com]
ok: [vm6.domain.com]
ok: [vm7.domain.com]
ok: [vm8.domain.com]

TASK [vcenter : Set the state of a virtual machine to poweroff] ***********************************************************************************************************
fatal: [vm1.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM1'"}
fatal: [vm2.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM2'"}
fatal: [vm3.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM3'"}
fatal: [vm4.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM4'"}
fatal: [vm5.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM5'"}
fatal: [vm6.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM6'"}
fatal: [vm7.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM7'"}
fatal: [vm8.domain.com -> localhost]: FAILED! => {"changed": false, "msg": "Unable to set power state for non-existing virtual machine : 'VM8'"}

PLAY RECAP ****************************************************************************************************************************************************************
vm1.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
vm2.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
vm3.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
vm4.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
vm5.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
vm6.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
vm7.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0
vm8.domain.com   : ok=1    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

a)我如何摆脱Error when collecting winrm facts错误?(看起来 playbook 无法识别all.yml带有 win 的文件,但为什么?)
b)如何修复错误“无法为不存在的虚拟机设置电源状态...”?(我们可以看到lab_r.yml文件(来自库存库)中提到的fqdns对机器的playbook访问,但错误与vCenter平台中显示的机器名称有关......)

我的存储库:

C:.
├───ansible
│   │   ansible.cfg
│   ├───inventories
│   │   └───test
│   │       ├───cloud
│   │       └───onpremis
│   │           └───domain.com
│   │               │   lab_j.yml
│   │               │   lab_r.yml
│   │               └───group_vars
│   │                       all.yml
│   ├───playbooks
│   │       revert_lab.yml
│   └───roles
│       └───vcenter
│           ├───tasks
│           │       main.yml
│           │       poweroff.yml
│           │       poweron.yml
│           │       revert.yml
│           │       shutdown.yml
│           └───vars
│                   main.yml

我的库存 lab_r.yml- 这是部分架构

---
all:
  children:
    root:
      children:
        center:
          children:
            appservers:
              hosts:
                vm1.domain.com:
            qservers:
              hosts:
                vm2.domain.com:
            dbservers:
              hosts:
                vm3.domain.com:
virtualization deployment vmware-vcenter configuration ansible
  • 1 个回答
  • 358 Views
Martin Hope
Hiddai
Asked: 2021-07-17 03:59:40 +0800 CST

ansible 没有找到剧本中提到的角色

  • 0

我对 Ansible 很陌生,所以我可能配置错误
[我有一个运行 Ansible 服务的 Docker 容器
我​​有一个包含 Ansible 文件的 Ansible 存储库(这是一个 .Git 存储库)

我的意愿是自动将 vCenter 服务器中的每个实验室恢复为特定快照
所以,我(在ansible-roles-explained-with-examples 指南的帮助下):

  • ansible-galaxy init使用命令名称创建了一个角色vcenter(参见下面的目录树)
  • 在文件夹内创建了一些 vCenter 任务文件tasks(请参见下面的目录树)。以下是rever.yml任务文件的示例:
- name: Revert to a snapshot
  vmware_guest_snapshot:
    hostname: "{{ vcenter_hostname }}"
    username: "{{ vcenter_username }}"
    password: "{{ vcenter_password }}"
    datacenter: "{{ datacenter_name }}"
    state: revert
    snapshot_name: CLEAN
  delegate_to: localhost
  • 在文件中提供 vCenter 凭据vcenter\vars\main.yml,如下所示:
# vars file for vcenter
vcenter_hostname: vcenter.foo.com
vcenter_username: [email protected]
vcenter_password: f#0$o#1$0o
  • 将任务包含在tasks\main.yml带有import-task密钥的文件中,如下所示:
---
# tasks file for roles/vcenter
- import_tasks: poweroff.yml
- import_tasks: poweron.yml
- import_tasks: revert.yml
- import_tasks: shutdown.yml
  • 创建了一个revert_lab.yml包含角色的剧本,就像这样
---
- name: revert an onpremis lab
  hosts: all
  roles:
  - vcenter

在执行 playbook 以还原实验室中的所有机器之前,我对 playbook 语法进行了一些检查:

ansible-playbook playbooks/revert_lab.yml --syntax-check

我得到的错误是:

[WARNING]: Ansible is being run in a world writable directory (/ansible), ignoring it as an ansible.cfg source. For more information see
https://docs.ansible.com/ansible/devel/reference_appendices/config.html#cfg-in-world-writable-dir
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC
 4.8.5 20150623 (Red Hat 4.8.5-44)]. This feature will be removed from ansible-core in version 2.12. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
[WARNING]: No inventory was parsed, only implicit localhost is available
[WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all'
ERROR! the role 'vcenter' was not found in /ansible/playbooks/roles:/root/.ansible/roles:/usr/share/ansible/roles:/etc/ansible/roles:/ansible/playbooks

The error appears to be in '/ansible/playbooks/revert_lab.yml': line 5, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:

  roles:
  - vcenter
    ^ here

我决定ansible.cfg使用 a 键添加到我的存储库roles_path:

[defaults]
inventory = /ansible/inventories
roles_path = /ansible/roles
# roles_path = ./roles:..~/ansible/roles

我再次运行--syntax-check命令但得到了同样的错误。我尝试了不同类型的角色路径语句 - 并得到了同样的错误。当然ansible-playbook命令不起作用(带有相同的错误消息):

ansible-playbook playbooks/revert_lab.yml -i inventories/test/onpremis/domain.com/lab_r.yml

那么,如何让 ansible 识别我的角色?
如何使 ansible 成功运行我的剧本?
ansible.cfg 与“故事”相关还是无关?

我的存储库:

C:.
├───ansible
│   │   ansible.cfg
│   ├───inventories
│   │   └───test
│   │       ├───cloud
│   │       └───onpremis
│   │           └───domain.com
│   │               │   lab_j.yml
│   │               │   lab_r.yml
│   │               └───group_vars
│   │                       all.yml
│   ├───playbooks
│   │       revert_lab.yml
│   └───roles
│       └───vcenter
│           ├───tasks
│           │       main.yml
│           │       poweroff.yml
│           │       poweron.yml
│           │       revert.yml
│           │       shutdown.yml
│           └───vars
│                   main.yml
virtualization deployment configuration ansible azure-devops
  • 1 个回答
  • 635 Views
Martin Hope
Hiddai
Asked: 2021-07-09 15:52:09 +0800 CST

构建 ansible Dockerfile 结果错误找不到 pip3

  • 0
  • 我尝试通过本地 Dockerfile 构建 ansible 的图像:
  • 我从以下 Docker 文件中获得:快速入门:在 Docker 容器中配置 Ansible
FROM centos:7

RUN yum check-update; \
    yum install -y gcc libffi-devel python3 epel-release; \
    yum install -y python3-pip; \
    yum install -y wget; \
    yum clean all

RUN pip3 install --upgrade pip; \
    pip3 install "ansible"; \
    wget -q https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt; \
    pip3 install -r requirements-azure.txt; \
    rm requirements-azure.txt; \
    ansible-galaxy collection install azure.azcollection
    pip3 install "pywinrm>=0.2.2" 

WORKDIR /product

CMD [ "/usr/sbin/init" ]
  • 最后三行是我的补充:pip3 install "pywinrm>=0.2.2", WORKDIR /product,CMD [ "/usr/sbin/init" ]
  • 我通过 VSCODE 运行此 Dockerfile > 右键单击​​ docker-compose 文件并选择Compose Up选项
version: '2'
services:
  ansible:
    container_name: ansible
    hostname: ansible
    image: ansible
    build:
      context: .
      dockerfile: Dockerfile
    volumes: 
      - ../../../../../../../:/product
    dns:
      - 200.0.10.100
  • 我已经成功构建并运行了这个镜像,但最近我创建了新的 git 存储库并将它们克隆到我的主机。在那里,我将这两个文件放在一个文件夹中。
  • 作为构建图像的结果,我收到以下错误:
#6 187.2 ERROR! Neither the collection requirement entry key 'name', nor 'source' point to a concrete resolvable collection artifact. Also 'name' is not an FQCN. A valid collection name must be in the format <namespace>.<collection>. Please make sure that the namespace and the collection name  contain characters from [a-zA-Z0-9_] only.     
#6 187.2
#6 187.2 Could not find pip3.
------
executor failed running [/bin/sh -c yum install -y python3-pip;     pip3 install --upgrade pip;     pip3 install "ansible";     wget -q https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt;     pip3 install -r requirements-azure.txt;     rm requirements-azure.txt;     ansible-galaxy collection install azure.azcollection     pip3 install "pywinrm>=0.2.2"]: exit code: 1
ERROR: Service 'ansible' failed to build : Build failed
The terminal process "C:\windows\System32\WindowsPowerShell\v1.0\powershell.exe -Command docker-compose -f "images\local\ansible\v210\docker-compose.yml" up -d --build" terminated with exit code: 1.

Terminal will be reused by tasks, press any key to close it.
  • 看起来第一个RUN命令根本没有执行
  • 我尝试docker build .了docker-compose up命令 - 无法创建容器
  • 我试图清理我所有的容器、图像和卷并再次构建 - 未能创建容器(我按照本指南:在此处输入链接描述,还使用了 rm 命令)

那么,缺少什么或者我需要修复什么才能使其正常工作?

docker docker-compose
  • 1 个回答
  • 396 Views
Martin Hope
Hiddai
Asked: 2021-06-30 12:22:25 +0800 CST

如何使用清单和 group_vars 文件对主机进行 win_ping 操作?

  • 1
  • 我正在尝试编写一个正确的命令行,它将 ping 到我的清单文件中详细说明的所有主机
  • 我的码头文件:
FROM centos:7

RUN yum check-update; \
    yum install -y gcc libffi-devel python3 epel-release; \
    yum install -y python3-pip; \
    yum install -y wget; \
    yum clean all

RUN pip3 install --upgrade pip; \
    pip3 install "ansible"; \
    wget -q https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt; \
    pip3 install -r requirements-azure.txt; \
    rm requirements-azure.txt; \
    ansible-galaxy collection install azure.azcollection \

WORKDIR /github
CMD ["/usr/sbin/init"]
  • 所有主机都是 Windows 操作系统主机
  • 在我的 Ansible 库结构下方
C:.
└───bla_product
    └───core
        ├───ansible
        │   ├───inventories
        │   │   ├───production
        │   │   ├───staging
        │   │   └───test
        │   │       ├───cloud
        │   │       └───onpremis
        │   │           └───domain.com
        │   │               │   lab_x.yml
        │   │               │
        │   │               └───group_vars
        │   │                       windows.yml
        │   │
        │   ├───playbooks
        │   └───roles
  • 我的库存文件 lab_x.yml 如下所示:
---
all:
  children:
    root:
      children:
        center:
          children:
            appservers:
              hosts:
                centeriis.domain.com:
                  ansible_host: 200.10.0.100
            qservers:
              hosts:
                centerq.domain.com:
                  ansible_host: 200.10.0.101
            dbservers:
              hosts:
                centerdb.domain.com:
                  ansible_host: 200.10.0.102
        serverfarms:
          hosts:
          children:
            gateways:
              hosts:
        south:
          children:
            brooklyn:
              hosts:
                  srv1.domain.com:
                    ansible_host: 200.10.0.103
              children:
                endpoints:
                  hosts:
                    client1.domain.com:
                      ansible_host: 200.10.0.105
                    client2.domain.com:
                      ansible_host: 200.10.0.106
        north:
          children:
            newyork:
              hosts:
                srv2.domain.com:
                  ansible_host: 200.10.0.104
              children:
                endpoints:
                  hosts:
                    client3.domain.com:
                      ansible_host: 200.10.0.107
  • 该windows.yml文件包含引用所有主机的连接详细信息,因为它们都是 Windows 操作系统主机:
---
ansible_connection: winrm
ansible_user: domain\user
ansible_password: password
  • 运行以下命令ansible all -i lab_r.yml -m win_ping结果:
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC
 4.8.5 20150623 (Red Hat 4.8.5-44)]. This feature will be removed from ansible-core in version 2.12. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
centeriis.domain.com | UNREACHABLE! => {
    "changed": false,
    "msg": "[Errno None] Unable to connect to port 22 on 200.10.0.100",
    "unreachable": true
}
  • 尝试这个ansible windows.yml -i lab_r.yml -m win_ping给出:
[DEPRECATION WARNING]: Ansible will require Python 3.8 or newer on the controller starting with Ansible 2.12. Current version: 3.6.8 (default, Nov 16 2020, 16:55:22) [GCC
 4.8.5 20150623 (Red Hat 4.8.5-44)]. This feature will be removed from ansible-core in version 2.12. Deprecation warnings can be disabled by setting 
deprecation_warnings=False in ansible.cfg.
[WARNING]: Could not match supplied host pattern, ignoring: windows.yml
[WARNING]: No hosts matched, nothing to do
  • 我在这个“故事”中缺少什么?
  • 文件或命令有问题吗?
  • Ansible 使用 22 端口而不是 WinRM 协议的原因是什么?
  • win_ping 命令可以在这个阶段工作还是我必须持有剧本和角色(任务)文件才能工作?
  • 如何使整个业务正常运行(使用 Inventories 和 group_vars 文件夹中的文件的命令)?
ansible devops
  • 1 个回答
  • 495 Views
Martin Hope
Hiddai
Asked: 2021-06-23 02:55:48 +0800 CST

在清单 ansible yaml 文件中要提及哪些常见变量?

  • 0
  • 我尝试建立管道来安装我的产品。
  • 我的产品安装在至少有 8 台机器的实验室中(本地实验室)。
  • 我有几个本地实验室,几个云端实验室
  • 每台机器都有一个角色,例如:Center-DB机器,Center-Queue机器或Center-App机器,Middle机器和Client机器等......所以,一些实验室是:1 Center - 1 Middle - 1 位客户。或 3 个中心(应用程序、数据库、队列) - 2 个中间件 - 3 个客户端
  • 有些机器有一种服务,如 DB,有些机器有几种:DB、IIS 和消息代理
  • 该实验室位于一个安全的 VLAN 中,这意味着为了从远程运行脚本,我需要使用它们的 IP 而不是它们的 FQDN 连接到机器并提供凭据。
  • 所有机器的凭据都相同。
  • 此外,安装文件中还有一个选项来安装产品安全(使用证书和端口 443)或不安全。
  • 在安装过程中,我需要先将其特定的安装文件复制到每台机器上,然后使用特定的参数进行安装。

除了清单 ansible yaml 文件中的主机和 IP 地址列表之外,是否可以添加变量或键,例如:

  • “证书”
  • “协议”,
  • “文件”,
  • “机器类型”等......?

或者他们应该放在不同的文件中,比如角色(任务)。请帮我决定哪些信息去哪里。我的示例 yaml 文件如下:

---
cred:
    user: a
    pass: 1
center:
    dbs:
        - db:
              fqdn: center-db.foo.com
              cn: center-db
              files:
                  - C:\folder\Server.msi
              ip: 1.1.1.1
    queues: 
        - queue: 
              fqdn: center-queue.foo.com
              cn: center-queue
              files:
                  - C:\folder\Server.msi
              ip: 2.2.2.2
    apps:
        - app:
              fqdn: center-app.foo.com
              cn: center-app
              files:
                  - C:\folder\Server.msi
                  - C:\folder\Center-Client.msi
                  - C:\folder\files
              ip: 3.3.3.3
                  

               clients:
                  - client:
                        db:
                            cn: Client-DB
                        app:
                            fqdn: Client-APP.foo.com
                            cn: Client-APP
                            files:
                                - C:\folder\Server.msi
                                - C:\folder\Client-Client.msi
                            ip: 4.4.4.4
ansible devops azure-devops
  • 1 个回答
  • 293 Views
Martin Hope
Hiddai
Asked: 2020-11-09 00:08:19 +0800 CST

通过 GPO 部署库

  • 0

我的 AD 服务器的“C:\Program Files\WindowsPowerShell\Modules\Carbon”中有一个 Carbon 文件夹
如何将此文件夹(及其内容)部署到同一位置(“C:\Program Files\WindowsPowerShell\Modules”)通过 GPO 在域的端点中?

group-policy
  • 1 个回答
  • 74 Views
Martin Hope
Hiddai
Asked: 2020-04-14 12:20:13 +0800 CST

我可以同时运行多少个虚拟机(服务器)?[复制]

  • -2
这个问题在这里已经有了答案:
你能帮我做容量规划吗? (3 个回答)
2年前关闭。

让我们暂时搁置内存问题。如果我有两个 64 核 AMD EPYC 处理器,我可以同时运行多少个虚拟机(服务器)?我可以同时运行 64 个虚拟机对吗?(假设每个 vm 需要 2 个逻辑处理器)。在阅读以下文章时提出了我的问题:选择虚拟机的处理器数量

virtualization
  • 2 个回答
  • 5480 Views

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve