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
    • 最新
    • 标签
主页 / server / 问题

问题[devops](server)

Martin Hope
Jorge Mauricio
Asked: 2022-02-28 14:28:23 +0800 CST

用于 docker 镜像验证的 Puppet manifest 配置

  • 1

我对 devops/ci/cd 很陌生,所以请耐心等待。

目前,我正在为 docker 图像验证设置一个 puppet manifest 配置。让我尝试布局它:

我有一个具有以下配置的 puppet master 服务器:

  • Puppetmaster 版本:5.5.10-4ubuntu3
  • 两台服务器都是linux 20.04
  • 全部托管在 AWS 上

/etc/puppet/code/environments/production/manifests/site.pp

node default {
    include 'docker'
    docker::image { 'jorgemauriciodev/ubuntu-dockerfile-dev-v1': }
}

每次在 .pp 中尝试新的验证命令时,我都会使用以下命令重新启动 puppet master 服务器:sudo systemctl restart puppet-master

我在我的两台服务器(代理和主服务器)上都安装了一个名为 garethr-docker 的模块。

在从/代理服务器上,我有这个镜像 docker 镜像存在并正在运行:jorgemauriciodev/ubuntu-dockerfile-dev-v1 第一步,我只想检查我的从属服务器中是否存在该镜像。稍后,我将确定它正在运行或使用 Dockerfile 构建。

在从/代理服务器上,我运行:sudo puppet agent –test

我收到以下错误消息:

错误:无法从远程服务器检索目录:服务器上的错误 500:服务器错误:评估错误:评估函数调用时出错,找不到类 ::docker 用于 ip-123-123-123-123.us-east- 2.compute.internal(文件:/etc/puppet/code/environments/production/manifests/site.pp,行:2,列:5)在节点 ip-123-123-123-123.us-east-2 .compute.internal 警告:未在失败的目录上使用缓存错误:无法检索目录;跳过跑步

有人知道我对 puppet 清单文件有什么问题吗?

编辑1:

我做了一些建议的更改。现在,我的文件有一个不同的名称并更改了内容:/etc/puppet/code/environments/production/manifests/init.pp

include 'docker'
class { 'docker':
  version => 'latest',
}
docker::image { 'jorgemauriciodev/ubuntu-dockerfile-dev-v1': }

仍然返回相同的错误消息。

这是完整的消息:

/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Retrieving plugin
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Info: Retrieving locales
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:315: warning: deprecated Object#=~ is called on Puppet::Transaction::Report; it always returns nil
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/indirector/request.rb:272: warning: URI.unescape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Function Call, Could not find class ::docker for ip-172-31-21-116.us-east-2.compute.internal (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 1, column: 1) on node ip-172-31-21-116.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run
/usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0
/usr/lib/ruby/vendor_ruby/puppet/util.rb:461: warning: URI.escape is obsolete
/usr/lib/ruby/vendor_ruby/puppet/file_system/uniquefile.rb:126: warning: $SAFE will become a normal global variable in Ruby 3.0

编辑2:

我使用以下命令在主服务器和从/代理服务器上安装了更多模块:

sudo puppet module install puppetlabs-docker --version 4.1.2

它仍然向我返回一条错误消息,但现在似乎它是一个不同的消息。所以,现在可能是一个语法问题。

这是消息的重要部分。

Error: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Duplicate declaration: Class[Docker] is already declared; cannot redeclare (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 3) (file: /etc/puppet/code/environments/production/manifests/init.pp, line: 3, column: 1) on node ip-123-123-123-123.us-east-2.compute.internal
Warning: Not using cache on failed catalog
Error: Could not retrieve catalog; skipping run

除了这条消息,它仍然向我返回那些警告,但列表要大得多。但是,我认为目前这不是问题。

ubuntu puppet devops puppetmaster puppet-agent
  • 1 个回答
  • 103 Views
Martin Hope
Frederick Ollinger
Asked: 2022-02-25 10:47:13 +0800 CST

Terraform:如何在操作系统上检测和分支?

  • 1

鉴于 Terraform 的这段伪代码:

resource "null_resource" {
    provisioner "local-exec" {
        command = "echo hello"
        interpreter = local.os == "Windows" ? ["PowerShell", "-Command"] : ["bash"]
}

我如何让它在 Windows 上的 Powershell 和 Linux 上的 bash 中运行?

windows linux terraform devops
  • 2 个回答
  • 166 Views
Martin Hope
Bernd Haug
Asked: 2021-07-27 13:10:08 +0800 CST

系统范围的 Docker 登录?

  • 0

有没有办法将整台机器/Docker 守护进程记录到注册表中?

我看到的关于 docker login 和各种专有凭证助手使用的所有内容~/.docker/config.json,即每个用户。

我有一种情况,我想从私有注册表中提取图像;多人在这些机器上都拥有任意 sudo 访问权限,并且应该能够针对我们的注册表使用 Docker。

由于 Docker 访问无论如何都应该被读取为对机器的 root 访问(即,如果用户可以运行 Docker,则用户凭据不是相互安全的),并且 sudo 访问是相同但直接的,我想切入正题并记录整个机器在没有每个用户都必须跳过箍的情况下。

我可以提供一个文件,每个人都可以链接到他们config.json的 .

security authentication docker-registry docker devops
  • 1 个回答
  • 537 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
solveit
Asked: 2021-05-25 02:07:55 +0800 CST

如何在 Kubernetes 中检查应用程序响应

  • 1

我有一个在 K8s 编排中运行的用 C# 编写的 .net 框架应用程序。我只是想以固定的时间间隔(比如说每 300 秒)检查我在 pod 内运行的应用程序是否响应。

有人可以让我知道该怎么做吗?

.net kubernetes dotnet-framework devops
  • 1 个回答
  • 47 Views
Martin Hope
Dhanushka Ekanayake
Asked: 2021-05-12 21:10:31 +0800 CST

如何在 PowerShell 中获取文件的最近子目录作为输出?

  • 2

我只需要从文件路径中获取最近的子目录和文件名,如下所示。

前任:-

(1)E:\Dump\DumpText-1.txt - Dump\DumpText-1.txt

(2)E:\Dump\SubDump1\DumpText-1.txt - SubDump1\DumpText-1.txt

(3)E:\Dump\SubDump3\Sub_SubDump1\DumpText-1.txt -Sub_SubDump1\DumpText-1.txt

我的 PowerShell 脚本如下:

Get-ChildItem $directoryPath -Recurse | ForEach-Object -Process {if (!$_.PSIsContainer) {$_.FullName; $_.FullName -replace "^.*?\\"; " "}}
powershell directory devops
  • 2 个回答
  • 566 Views
Martin Hope
Parsifal15
Asked: 2020-10-07 12:45:37 +0800 CST

多少天蓝色的订阅太多了?

  • 0

我的组织目前有 50 个 azure 订阅,并计划增加到 500 多个,原因如下:每个应用程序都有自己的订阅,技术人员有自己的订阅,开发环境是临时创建的。有一个 devops 团队和一个 finops 团队,它们都具有脚本功能。但我想知道是否其他人有相同数量的订阅?它对他们有用吗?

best-practices azure devops subscription
  • 1 个回答
  • 65 Views
Martin Hope
Manikandan Ram
Asked: 2020-07-24 23:56:04 +0800 CST

Jenkins 与 Android 工作室的集成

  • 0

描述:我创建了一个 jenkins 作业,将 jenkins 与 Android Studio 集成以生成工件,

在Android Studio中构建项目时,构建成功..

但是当我通过 jenkins 构建相同的项目时,我收到以下错误..!

    Starting a Gradle Daemon (subsequent builds will be faster)

> Task :clean UP-TO-DATE
> Task :app:clean UP-TO-DATE

> Task :app:preBuild UP-TO-DATE
> Task :app:preDebugBuild UP-TO-DATE
> Task :app:compileDebugAidl NO-SOURCE
> Task :app:generateDebugBuildConfig
> Task :app:compileDebugRenderscript NO-SOURCE
> Task :app:javaPreCompileDebug

> Task :app:generateDebugResValues
> Task :app:generateDebugResources

> Task :app:createDebugCompatibleScreenManifests
> Task :app:extractDeepLinksDebug
> Task :app:processDebugManifest

> Task :app:mergeDebugResources

> Task :app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
   > Failed to transform navigation-ui-2.3.0.aar (androidx.navigation:navigation-ui:2.3.0) to match attributes {artifactType=android-compiled-dependencies-resources, org.gradle.category=library, org.gradle.dependency.bundling=external, org.gradle.libraryelements=aar, org.gradle.status=release, org.gradle.usage=java-runtime}.
      > Execution failed for AarResourcesCompilerTransform: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\d0f92c0b26fabb47a28488bab3cc8456\navigation-ui-2.3.0.
         > Android resource compilation failed
           AAPT: C:\Windows\System32\config\systemprofile\.gradle\caches\transforms-2\files-2.1\9db20844a7f2758cbc14bea528bced6c\androidx.navigation.ui: error: The system cannot find the file specified. (2).

任何帮助表示赞赏..!

java jenkins android devops
  • 2 个回答
  • 1264 Views
Martin Hope
varun saini
Asked: 2020-07-02 21:00:11 +0800 CST

将 nginx 从 http 转换为 https

  • 0

我在 aws lighsail 服务器上托管一个网站。它是单台服务器,我在上面运行 4 个 docker 容器。1-nginx,2-node js,3-spring bot,4-mysql。

至于现在我的网站加载很好:

    server {
    listen       80;
    server_name  *.example.com;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    client_max_body_size 100M;
    location / {
        proxy_pass http://cahub-client:4000;
    }

    location /api {
        rewrite /api/(.*) /$1  break;
        proxy_pass http://microservice:8080;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

我从 goddady 购买了 ssl 证书,现在安装在我的服务器上。

server {
    listen 80 default_server;
    listen [::]:80 default_server;
    server_name _;
    return 301 https://$host$request_uri;
    }

server {
    listen 443 ssl;
    server_name  *.domain.com;
    
    ssl_certificate /etc/nginx/certs/cae51a61335308544.pem;
    ssl_certificate_key /etc/nginx/certs/www.eaxmple.com.key;

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;
    client_max_body_size 200M;
    location / {
        proxy_pass http://cahub-client:4000;
    }

    location /api {
        rewrite /api/(.*) /$1  break;
        proxy_pass http://microservice:8080;
    }

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    #
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}

所以这里发生的事情就是现在。当我在 url 中输入我的域时,它会重定向到 https,但只有 angular 客户端位置块正在运行,这是我的前端。但是每当从前端到后端的调用时。它还应该转到我的反向代理块 /api.. 这不是 reolvong 而是找到错误混合上下文。当我在网络选项卡中看到时。我的前端调用是https://example.com,但我的后端调用是早先的http://example.com/api/。

ssl nginx reverse-proxy ssl-certificate devops
  • 1 个回答
  • 310 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